Closed adi518 closed 3 months ago
Can you make your reproduction minimal?
1 or 2 files if possible.
And remove the types, convert it to JS, and verify it works expectedly in Node.
Done. You now have three commands: start
for JS, start-tsx
, and start-ts-node
, so you can compare them. Btw, I also observed this behavior with SWC, which makes me suspect it's a strict mode thing or a configuration issue.
This is happening because of useDefineForClassFields
.
TypeScript (and ts-node) sets the target to ES3 by default, which yields this behavior. But tsx sets the target based on your Node.js runtime version.
Read more about it here: https://esbuild.github.io/content-types/#no-type-system
Acknowledgements
Minimal reproduction URL
https://stackblitz.com/edit/node-5p2jxx?file=index.ts
Version
v0.0.0
Node.js version
v18.18.0
Package manager
npm
Operating system
macOS
Problem & expected behavior (under 200 words)
t
was set toundefined
.t
to be set.Contributions