Skip to content

Commit

Permalink
3.21.3
Browse files Browse the repository at this point in the history
  • Loading branch information
colinhacks committed Mar 6, 2023
1 parent c458381 commit 2db0dca
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zod",
"version": "3.21.2",
"version": "3.21.3",
"author": "Colin McDonnell <colin@colinhacks.com>",
"repository": {
"type": "git",
Expand Down
16 changes: 16 additions & 0 deletions playground.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
import { z } from "./src";
z;

const baseCategorySchema = z.object({
name: z.string().brand("CategoryName"),
});

type CategoryInput = z.input<typeof baseCategorySchema> & {
subcategories: CategoryInput[];
};
type CategoryOutput = z.output<typeof baseCategorySchema> & {
subcategories: CategoryOutput[];
};

const categorySchema: z.ZodType<CategoryOutput, any, CategoryInput> =
baseCategorySchema.extend({
subcategories: z.lazy(() => categorySchema.array()),
});

0 comments on commit 2db0dca

Please sign in to comment.