From f76794db1b6103f3d9598bdfa7bf613811d65bb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gunnlaugur=20=C3=9E=C3=B3r=20Briem?= Date: Tue, 5 Sep 2023 12:38:38 +0000 Subject: [PATCH 1/4] repro --- example.ts | 23 ++++++++++++++++++++++- package.json | 1 + run.sh | 4 ++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/example.ts b/example.ts index a201bd7..8214378 100644 --- a/example.ts +++ b/example.ts @@ -1 +1,22 @@ -console.log('Some .ts code reproducing a bug'); +type Foo = { + foo: string, + bar: number, +} + +function foofn () { + throw new Error('bar'); +} + +try { + foofn(); +} +catch (err) { + const stack = (err as Error).stack || ''; + if (/at foofn \(.*\/example\.ts:7:.*\)/.exec(stack)) { + console.log('OK, stack seems to have correct line numbers.'); + } + else { + console.error('Grr, stack seems to have wrong line numbers.'); + throw err; + } +} diff --git a/package.json b/package.json index 4d56496..2bf5396 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,5 @@ { + "type": "module", "dependencies": { "ts-node": "latest", "typescript": "latest" diff --git a/run.sh b/run.sh index d553b44..3e896af 100644 --- a/run.sh +++ b/run.sh @@ -1,13 +1,13 @@ #!/usr/bin/env bash # Install a specific version of node -n lts +n v20 # Install package.json dependencies yarn # Run ts-node -yarn ts-node ./example.ts +node --loader ts-node/esm/transpile-only ./example.ts echo "Process exited with code: $?" echo From 9640384f05917c317843160ce9008ee0f5bc14f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gunnlaugur=20=C3=9E=C3=B3r=20Briem?= Date: Tue, 5 Sep 2023 13:05:45 +0000 Subject: [PATCH 2/4] add tsconfig --- tsconfig.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tsconfig.json diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..eb6a06f --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "lib": [ + "dom", + "esnext" + ] + }, + "includes": [ + "example.ts" + ] +} From f8d0d17ba3e4254846060c0799f113099b4b6ffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gunnlaugur=20=C3=9E=C3=B3r=20Briem?= Date: Tue, 5 Sep 2023 13:12:28 +0000 Subject: [PATCH 3/4] Empty out tsconfig.json --- tsconfig.json | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index eb6a06f..0967ef4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,11 +1 @@ -{ - "compilerOptions": { - "lib": [ - "dom", - "esnext" - ] - }, - "includes": [ - "example.ts" - ] -} +{} From b551e879d527385c9ee32875c1cf3b8e3a5cd83b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gunnlaugur=20=C3=9E=C3=B3r=20Briem?= Date: Tue, 12 Dec 2023 14:17:55 +0000 Subject: [PATCH 4/4] more minimal repro: this should reproduce with v18.19.0 --- run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run.sh b/run.sh index 3e896af..7ee6026 100644 --- a/run.sh +++ b/run.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Install a specific version of node -n v20 +n v18.19.0 # Install package.json dependencies yarn