Open t-animal opened 3 months ago
Hi @tvillaren do you have an ETA for a fix for this?
Hello,
Not really. I you have a solution in mind, please feel free to open a PR! 🙏 Thanks!
Fwiw, I saw that detection for this setting is already in the codebase, somewhere. I can't work on this atm, though....
Bug description
ts-to-zod does not include the filename in such a scenario, making it incompatible with "module"-packages running in node.
When running in node (i.e. not targeting a bundler/webbrowser), the typescript "module"-property must be set to
"node16"
or"nodenext"
. When usingtype:"module"
inpackage.json
, this means that imports have to include the ".js" suffix.A minimal example would be:
Running tsc gives the following error:
Our current solution is to fix the imports using
sed
in our build-script:Input
Multiple files containing types, referencing each other. E.g:
Expected output
a.zod.ts
should be:Actual output
Versions