diff options
author | 2022-07-27 15:39:05 +0000 | |
---|---|---|
committer | 2022-07-27 15:39:05 +0000 | |
commit | a397b981f5f46dee85e6e00aa39633d018d4b9a2 (patch) | |
tree | 8622069c50ed93364d01d62f2aa9ac664429ed14 /packages/integrations/image/src/lib/get-image.ts | |
parent | 55c8aced44a60a664f28de9dabf03ca51897599e (diff) | |
download | astro-a397b981f5f46dee85e6e00aa39633d018d4b9a2.tar.gz astro-a397b981f5f46dee85e6e00aa39633d018d4b9a2.tar.zst astro-a397b981f5f46dee85e6e00aa39633d018d4b9a2.zip |
Fixes type definitions `@astrojs/image` and adds more documentation to the README (#4045)
* WIP: moving to a static .d.ts types file
* fixing named exports for getImage and getPicture
* removing the exports.astro map for now
* WIP: adding readme docs for component attributes
* Adding docs for getImage and getPicture
* leaning fully on TSC to build .d.ts files
* finally found the solution for proper ESM import types
* adding a note to the README for tsconfig updates
* chore: add changesets
* typo
* docs: removing the "Images in Markdown" example
* removing the need for publishing src to NPM
* fix: make type re-export explicit
* updating image module defs to match InputFormat
* using astro syntax highlighting for README code blocks
* nit: missing backtick in README
* make sure Astro component directives aren't recommended twice
Diffstat (limited to 'packages/integrations/image/src/lib/get-image.ts')
-rw-r--r-- | packages/integrations/image/src/lib/get-image.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/packages/integrations/image/src/lib/get-image.ts b/packages/integrations/image/src/lib/get-image.ts index e0f57e873..0a28ff3ac 100644 --- a/packages/integrations/image/src/lib/get-image.ts +++ b/packages/integrations/image/src/lib/get-image.ts @@ -1,15 +1,15 @@ +/// <reference types="astro/astro-jsx" /> import slash from 'slash'; import { ROUTE_PATTERN } from '../constants.js'; import sharp from '../loaders/sharp.js'; import { - ImageAttributes, - ImageMetadata, ImageService, isSSRService, OutputFormat, TransformOptions, -} from '../types.js'; +} from '../loaders/index.js'; import { isRemoteImage, parseAspectRatio } from '../utils/images.js'; +import { ImageMetadata } from '../vite-plugin-astro-image.js'; export interface GetImageTransform extends Omit<TransformOptions, 'src'> { src: string | ImageMetadata | Promise<{ default: ImageMetadata }>; @@ -101,7 +101,7 @@ async function resolveTransform(input: GetImageTransform): Promise<TransformOpti * @param transform @type {TransformOptions} The transformations requested for the optimized image. * @returns @type {ImageAttributes} The HTML attributes to be included on the built `<img />` element. */ -export async function getImage(transform: GetImageTransform): Promise<ImageAttributes> { +export async function getImage(transform: GetImageTransform): Promise<astroHTML.JSX.ImgHTMLAttributes> { if (!transform.src) { throw new Error('[@astrojs/image] `src` is required'); } |