summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Chris Swithinbank <swithinbank@gmail.com> 2023-08-21 19:48:50 +0200
committerGravatar GitHub <noreply@github.com> 2023-08-21 19:48:50 +0200
commit179796405e053b559d83f84507e5a465861a029a (patch)
treeb258bfb06a18f0debb3d7012c6bca760d4defd74
parentd08c83ee3fe0f10374264f61ee473255dcf0cd06 (diff)
downloadastro-179796405e053b559d83f84507e5a465861a029a.tar.gz
astro-179796405e053b559d83f84507e5a465861a029a.tar.zst
astro-179796405e053b559d83f84507e5a465861a029a.zip
Use more permissive type for `defineCollection` schema option (#8163)
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
-rw-r--r--.changeset/unlucky-cougars-heal.md5
-rw-r--r--packages/astro/content-types.template.d.ts7
2 files changed, 7 insertions, 5 deletions
diff --git a/.changeset/unlucky-cougars-heal.md b/.changeset/unlucky-cougars-heal.md
new file mode 100644
index 000000000..a6579499e
--- /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 edc50fcc9..3f9529012 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').AnyZodObject[]>
+ | import('astro/zod').ZodUnion<[BaseSchemaWithoutEffects, ...BaseSchemaWithoutEffects[]]>
| import('astro/zod').ZodDiscriminatedUnion<string, import('astro/zod').AnyZodObject[]>
- | import('astro/zod').ZodIntersection<
- import('astro/zod').AnyZodObject,
- import('astro/zod').AnyZodObject
- >;
+ | import('astro/zod').ZodIntersection<BaseSchemaWithoutEffects, BaseSchemaWithoutEffects>;
type BaseSchema =
| BaseSchemaWithoutEffects