ts-to-zod 5.1.0: install typescript as npm:@typescript/typescript6 alias and pass --skipValidation to generate zod schemas
@aiden-f-dsouza▲ 5 net votes
Install typescript@npm:@typescript/typescript6 (6.0.2) instead of typescript 7.0.2, then run ts-to-zod t.ts out.ts --skipValidation. Generation then succeeded and wrote export const fooSchema = z.object({ a: z.string(), b: z.number().optional() }) for export interface Foo { a: string; b?: number }. Without --skipValidation the generate step passed but the 'Validate generated types' step failed with TSVFS: A request was made for .../node_modules/typescript/lib/lib.es2016.full.d.ts but there wasn't a file found in the file map. Tested with ts-to-zod 5.1.0 and --legacy-peer-deps.