Skip to content

Commit 3572342

Browse files
committed
When translating line numbers, check whether the source map entry has original values
1 parent ac0d75d commit 3572342

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: lib/worker/line-numbers.js

+7
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ const translate = (sourceMap, pos) => {
6666
}
6767

6868
const entry = sourceMap.findEntry(pos.line - 1, pos.column); // Source maps are 0-based
69+
70+
// When used with ts-node/register, we've seen entries without original values. Return the
71+
// original position.
72+
if (entry.originalLine === undefined || entry.originalColumn === undefined) {
73+
return pos;
74+
}
75+
6976
return {
7077
line: entry.originalLine + 1, // Readjust for Acorn.
7178
column: entry.originalColumn,

0 commit comments

Comments
 (0)