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
This possible? Be cool if we can leverage other type aliases.
Input:
export const BusSchema = z.object({ foo: z.string(), bar: z.boolean().optional() }); export const BazSchema = z.object({ boo: z.object({ one: z.number(), two: z.number().optional() }) }); export const TestSchema = z.object({ baz: BazSchema, bus: BusSchema }); const identifier = 'TestSchema'; const { node } = zodToTs(TestSchema, identifier); const typeAlias = createTypeAlias(node, identifier); return printNode(typeAlias);
Expected Output:
export type BusSchema = { foo: string(); bar?: boolean(); } export type BazSchema = { boo: { one: number; two?: number; } } export type TestSchema = { baz: BazSchema; bus: BusSchema; }
Actual Output:
export type BazSchema = { boo: { one: number; two?: number | undefined; }; }; export type BusSchema = { foo: string; bar?: boolean | undefined; } export type TestSchema = { baz: { boo: { one: number; two?: number | undefined; }; }; bus: { foo: string; bar?: boolean | undefined; }; };
The text was updated successfully, but these errors were encountered:
Anyone have any idea if this is possible or not?
Sorry, something went wrong.
+1
It's not possible using this library here, but we just built a system to do it internally.
Hello @opiepj, feel free to check out this library zod-to-typescript.
No branches or pull requests
This possible? Be cool if we can leverage other type aliases.
Input:
Expected Output:
Actual Output:
The text was updated successfully, but these errors were encountered: