ts-node
ts-node copied to clipboard
Line numbers in stack traces are wrong in Node v20
Search Terms
line numbers
Note that there is https://github.com/TypeStrong/ts-node/issues/1495, closed almost two years ago, long before Node v20 came out. I opened a new issue because (a) root causes are likely different even if the manifestation is similar, and (b) the way to reproduce is likely different as well, and (c) I can't reopen that old one anyway :) but the problem is clearly present today.
Expected Behavior
I expect line numbers in stack traces thrown from TypeScript code to match the actual line numbers in the file, when running under Node v20, as they do when running under Node v18 and v19.
Actual Behavior
When running under Node v20, line numbers in stack traces are wrong, appearing to be from the transpiled version of the module.
Steps to reproduce the problem
Run a TypeScript module in which an error is thrown. Observe that the line numbers in the stack trace of that error are incorrect when running in Node v20, but are correct when running in Node v18 or v19.
Minimal reproduction
https://github.com/TypeStrong/ts-node-repros/pull/34
Specifications
- ts-node version: v10.9.1
- node version: v20.5.1
- TypeScript version: v5.2.2
- tsconfig.json, if you're using one:
{}
- package.json:
{
"type": "module",
"dependencies": {
"ts-node": "latest",
"typescript": "latest"
}
}
- Operating system and version: macOS 13.5.1 (22G90)