summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.changeset/perfect-humans-wink.md5
-rw-r--r--packages/astro/src/content/template/types.d.ts13
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 =