Skip to content

Commit a178422

Browse files
authored
Support extending the image API props type (#15014)
1 parent 0d2adac commit a178422

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

.changeset/smooth-zoos-say.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': patch
3+
---
4+
5+
Adds support for extending the type of the props accepted by Astro’s `<Image>` component, `<Picture>` component, and `getImage()` API.

packages/astro/src/assets/types.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export type ImageTransform = {
9090
fit?: ImageFit | undefined;
9191
position?: string | undefined;
9292
[key: string]: any;
93-
};
93+
} & Astro.CustomImageProps;
9494

9595
export interface GetImageResult {
9696
rawOptions: ImageTransform;
@@ -231,7 +231,8 @@ type ImageSharedProps<T> = T & {
231231
fit?: never;
232232
position?: never;
233233
}
234-
);
234+
) &
235+
Astro.CustomImageProps;
235236

236237
export type LocalImageProps<T> = ImageSharedProps<T> & {
237238
/**

packages/astro/src/types/public/extendables.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ declare global {
2020
namespace Astro {
2121
export interface IntegrationHooks extends BaseIntegrationHooks {}
2222
export interface ClientDirectives extends AstroClientDirectives {}
23+
export interface CustomImageProps {}
2324
}
2425
}
2526

0 commit comments

Comments
 (0)