-
Notifications
You must be signed in to change notification settings - Fork 13k
Open
Labels
BugA bug in TypeScriptA bug in TypeScript
Milestone
Description
TypeScript Version: Version 3.8.0-dev.20191023
Search Terms:
source map, source map new line
Code
tsc --inlineSourceMap test.ts
test.ts
console.log('hello');
console.log('world');
test.js
console.log('hello');
console.log('world');
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsQ0FBQztBQUNyQixPQUFPLENBQUMsR0FBRyxDQUFDLE9BQU8sQ0FBQyxDQUFDIn0=
Source map breaks down into:
"console": test.ts:1:0
".": test.ts:1:7
"log": test.ts:1:8
"(": test.ts:1:11
"'hello'": test.ts:1:12
")": test.ts:1:19
";": test.ts:1:20
"\n": test.ts:1:21 <-- line end
"console": test.ts:2:0
".": test.ts:2:7
"log": test.ts:2:8
"(": test.ts:2:11
"'world'": test.ts:2:12
")": test.ts:2:19
";": test.ts:2:20
"": test.ts:2:21 <-- line end
Expected behavior:
Line end characters left unmapped.
Actual behavior:
Line end characters are included in the mapping, with the column number that equals to the length of the line -- which exceeds the boundary, given that column number is 0-based in a source map.
The spec doesn't cover if mappings for line ending characters should be included. But this behavior breaks some tools (eg. source-map-explorer) with strict boundary checks.
Playground Link:
Related Issues:
Bessonov, egasimus, mradkov and diegodorado
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScript