From c49f7036b65197a2aef8346a7c602badfac8df26 Mon Sep 17 00:00:00 2001 From: Princesseuh Date: Thu, 16 Mar 2023 19:47:29 +0100 Subject: [PATCH 1/2] fix(assest): Fix `image()` type to be compatible with ImageMetadata --- packages/astro/src/content/template/types.d.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/astro/src/content/template/types.d.ts b/packages/astro/src/content/template/types.d.ts index 0651773dd204..2485e2699260 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 = (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 = From f3809938d37522d7dfced731bd112606289fb5f5 Mon Sep 17 00:00:00 2001 From: Princesseuh Date: Thu, 16 Mar 2023 19:47:58 +0100 Subject: [PATCH 2/2] chore: changeset --- .changeset/perfect-humans-wink.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/perfect-humans-wink.md diff --git a/.changeset/perfect-humans-wink.md b/.changeset/perfect-humans-wink.md new file mode 100644 index 000000000000..7138b43ac940 --- /dev/null +++ b/.changeset/perfect-humans-wink.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix image() type to be compatible with ImageMetadata