diff options
author | 2023-03-16 22:35:14 +0100 | |
---|---|---|
committer | 2023-03-16 22:35:14 +0100 | |
commit | f413446a859e497395b3612e44d1540cc6b9dad7 (patch) | |
tree | f683b9c00ca185f255a7c29cf679bca608dba800 | |
parent | b53e8b3fb1aa8a2c4c5d5c9b194a541cfea65a52 (diff) | |
download | astro-f413446a859e497395b3612e44d1540cc6b9dad7.tar.gz astro-f413446a859e497395b3612e44d1540cc6b9dad7.tar.zst astro-f413446a859e497395b3612e44d1540cc6b9dad7.zip |
Fix `image()` type to be compatible with ImageMetadata (#6568)
* fix(assest): Fix `image()` type to be compatible with ImageMetadata
* chore: changeset
-rw-r--r-- | .changeset/perfect-humans-wink.md | 5 | ||||
-rw-r--r-- | packages/astro/src/content/template/types.d.ts | 13 |
2 files changed, 17 insertions, 1 deletions
diff --git a/.changeset/perfect-humans-wink.md b/.changeset/perfect-humans-wink.md new file mode 100644 index 000000000..7138b43ac --- /dev/null +++ b/.changeset/perfect-humans-wink.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix image() type to be compatible with ImageMetadata diff --git a/packages/astro/src/content/template/types.d.ts b/packages/astro/src/content/template/types.d.ts index 0651773dd..2485e2699 100644 --- a/packages/astro/src/content/template/types.d.ts +++ b/packages/astro/src/content/template/types.d.ts @@ -13,11 +13,22 @@ declare module 'astro:content' { export type CollectionEntry<C extends keyof typeof entryMap> = (typeof entryMap)[C][keyof (typeof entryMap)[C]]; + // This needs to be in sync with ImageMetadata export const image: () => import('astro/zod').ZodObject<{ src: import('astro/zod').ZodString; width: import('astro/zod').ZodNumber; height: import('astro/zod').ZodNumber; - format: import('astro/zod').ZodString; + format: import('astro/zod').ZodUnion< + [ + import('astro/zod').ZodLiteral<'png'>, + import('astro/zod').ZodLiteral<'jpg'>, + import('astro/zod').ZodLiteral<'jpeg'>, + import('astro/zod').ZodLiteral<'tiff'>, + import('astro/zod').ZodLiteral<'webp'>, + import('astro/zod').ZodLiteral<'gif'>, + import('astro/zod').ZodLiteral<'svg'> + ] + >; }>; type BaseSchemaWithoutEffects = |