We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello! I was using using it like this
import { z } from 'zod' import { createTypeAlias, printNode, zodToTs } from 'zod-to-ts' const schema = z.object({ required: z.string(), optional: z.string().optional(), default: z.string().optional().default('default'), }) const { node } = zodToTs(schema, 'Test') const typeAlias = createTypeAlias(node, 'Test') console.log(printNode(typeAlias)) type Infer = z.infer<typeof schema> type Input = z.input<typeof schema>
It prints out default with a ?
type Test = { required: string; optional?: string | undefined; default?: string; };
type Infer
type Infer = { required: string; default: string; optional?: string | undefined; }
type Input
type Input = { required: string; optional?: string | undefined; default?: string | undefined; }
In infer, the type of default is not optional. Is there an option or something to get the type of z.infer?
z.infer
The text was updated successfully, but these errors were encountered:
It looks like it should be doing this actually
https://github.com/sachinraja/zod-to-ts/blob/main/src/index.ts#L363
Let me see if I can find the issue
Sorry, something went wrong.
Hello @amritk, feel free to check out this library zod-to-typescript. it should address your issue thanks to its Hook system.
Successfully merging a pull request may close this issue.
Hello! I was using using it like this
It prints out default with a ?
type Infer
type Input
In infer, the type of default is not optional. Is there an option or something to get the type of
z.infer
?The text was updated successfully, but these errors were encountered: