From 179796405e053b559d83f84507e5a465861a029a Mon Sep 17 00:00:00 2001 From: Chris Swithinbank Date: Mon, 21 Aug 2023 19:48:50 +0200 Subject: [PATCH] Use more permissive type for `defineCollection` schema option (#8163) Co-authored-by: Nate Moore --- .changeset/unlucky-cougars-heal.md | 5 +++++ packages/astro/content-types.template.d.ts | 7 ++----- 2 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 .changeset/unlucky-cougars-heal.md diff --git a/.changeset/unlucky-cougars-heal.md b/.changeset/unlucky-cougars-heal.md new file mode 100644 index 0000000000..a6579499e9 --- /dev/null +++ b/.changeset/unlucky-cougars-heal.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Make typing of `defineCollection` more permissive to support advanced union and intersection types diff --git a/packages/astro/content-types.template.d.ts b/packages/astro/content-types.template.d.ts index edc50fcc9f..3f95290126 100644 --- a/packages/astro/content-types.template.d.ts +++ b/packages/astro/content-types.template.d.ts @@ -53,12 +53,9 @@ declare module 'astro:content' { type BaseSchemaWithoutEffects = | import('astro/zod').AnyZodObject - | import('astro/zod').ZodUnion + | import('astro/zod').ZodUnion<[BaseSchemaWithoutEffects, ...BaseSchemaWithoutEffects[]]> | import('astro/zod').ZodDiscriminatedUnion - | import('astro/zod').ZodIntersection< - import('astro/zod').AnyZodObject, - import('astro/zod').AnyZodObject - >; + | import('astro/zod').ZodIntersection; type BaseSchema = | BaseSchemaWithoutEffects