sachinraja / zod-to-ts

generate TypeScript types from your Zod schema
MIT License
342 stars 18 forks source link

wrong conversion coerce type #87

Open mathcovax opened 5 months ago

mathcovax commented 5 months ago

input:

zod.object({
    test: zod.coerce.string()
})

output:

{
    test?: string; 
}

The property is defined as possibly undefined, which is false.

Thank you for your work. 😄

kevbook commented 2 months ago

Not sure if this package is updated. But I needed something today that had coerce, nullable, defaults, date and inline comments. So here it is, if someone can make it a module. https://gist.github.com/kevbook/861e0885296827bf15530e3a921e1246