ts-to-zod: Types validation are not working on Ubuntu

Bug description

When ever I try to generate types I get an error. Zod and ts-to-zod are both installed. What am I doing wrong?

Input

➜  git:(develop) ✗ npx ts-to-zod ./src/types/client.ts ./src/types/client.ts
✖ Validating generated types
 ›   Error: File '/.../source.ts' is not a module.

Versions

  • Typescript: v4.4.3
  • Zod: v3.9.1

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 17 (8 by maintainers)

Most upvoted comments

And I’m seeing the same in PowerShell and cmd on Windows. I also see it when running PS or cmd as admin.

(node v14.17.6)

… good work and awesome tool btw 👍

Normally the library is well tested, this is just to help me to find some little edge cases 😉

Thanks for looking into it so quickly. I’m okay for now running it with --skipValidation for now, so just take your time.

I’m on windows, I tried on a WSL (Ubuntu 21 like you) and this is working, but codesandbox seams to have the same issue 😅

I guess this will be good enough for debugging, even if playing with vim to hack node_module is not the best DX 😓

Thanks for the reporting anyway, and sorry for this really unexpected issue, I will try to find a fix quickly (you can also give a try if you have some idea)