diff --git a/.changeset/smooth-zoos-say.md b/.changeset/smooth-zoos-say.md new file mode 100644 index 000000000000..402e598b5b69 --- /dev/null +++ b/.changeset/smooth-zoos-say.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Adds support for extending the type of the props accepted by Astro’s `` component, `` component, and `getImage()` API. diff --git a/packages/astro/src/assets/types.ts b/packages/astro/src/assets/types.ts index 6f14e6163b65..820988ec7e91 100644 --- a/packages/astro/src/assets/types.ts +++ b/packages/astro/src/assets/types.ts @@ -90,7 +90,7 @@ export type ImageTransform = { fit?: ImageFit | undefined; position?: string | undefined; [key: string]: any; -}; +} & Astro.CustomImageProps; export interface GetImageResult { rawOptions: ImageTransform; @@ -231,7 +231,8 @@ type ImageSharedProps = T & { fit?: never; position?: never; } - ); + ) & + Astro.CustomImageProps; export type LocalImageProps = ImageSharedProps & { /** diff --git a/packages/astro/src/types/public/extendables.ts b/packages/astro/src/types/public/extendables.ts index b78777cbd904..8281328ef27b 100644 --- a/packages/astro/src/types/public/extendables.ts +++ b/packages/astro/src/types/public/extendables.ts @@ -20,6 +20,7 @@ declare global { namespace Astro { export interface IntegrationHooks extends BaseIntegrationHooks {} export interface ClientDirectives extends AstroClientDirectives {} + export interface CustomImageProps {} } }