diff --git a/.changeset/red-boxes-bet.md b/.changeset/red-boxes-bet.md new file mode 100644 index 000000000000..18642ea970db --- /dev/null +++ b/.changeset/red-boxes-bet.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes typechecking for content config schema diff --git a/packages/astro/types/content.d.ts b/packages/astro/types/content.d.ts index c40d867a4040..5c9101549894 100644 --- a/packages/astro/types/content.d.ts +++ b/packages/astro/types/content.d.ts @@ -45,11 +45,18 @@ declare module 'astro:content' { has: (key: string) => boolean; } + type BaseAtomicSchema = import('astro/zod').AnyZodObject; + + type BaseCompositeSchema = + | import('astro/zod').ZodUnion<[BaseAtomicSchema, ...BaseAtomicSchema[]]> + | import('astro/zod').ZodDiscriminatedUnion + // If we have a union of unions, give up on trying to type-check it all. You're on your own. + | import('astro/zod').ZodUnion<[import('astro/zod').ZodUnion, ...z.any[]]> + type BaseSchemaWithoutEffects = - | import('astro/zod').AnyZodObject - | import('astro/zod').ZodUnion<[BaseSchemaWithoutEffects, ...BaseSchemaWithoutEffects[]]> - | import('astro/zod').ZodDiscriminatedUnion - | import('astro/zod').ZodIntersection; + | BaseAtomicSchema + | BaseCompositeSchema + | import('astro/zod').ZodIntersection; export type BaseSchema = | BaseSchemaWithoutEffects