diff --git a/package.json b/package.json index e57bdae93..9a44f634a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zod", - "version": "3.21.2", + "version": "3.21.3", "author": "Colin McDonnell ", "repository": { "type": "git", diff --git a/playground.ts b/playground.ts index d17b18eb4..b22662a96 100644 --- a/playground.ts +++ b/playground.ts @@ -1,2 +1,18 @@ import { z } from "./src"; z; + +const baseCategorySchema = z.object({ + name: z.string().brand("CategoryName"), +}); + +type CategoryInput = z.input & { + subcategories: CategoryInput[]; +}; +type CategoryOutput = z.output & { + subcategories: CategoryOutput[]; +}; + +const categorySchema: z.ZodType = + baseCategorySchema.extend({ + subcategories: z.lazy(() => categorySchema.array()), + });