-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
TypeScript Version: 2.2.1
Code
async function bar(): Promise<void> {
await foo();
let x = 1;
}produces
function bar() {
return __awaiter(this, void 0, void 0, function () {
var x;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, foo()];
case 1:
_a.sent();
x = 1;
return [2 /*return*/];
}
});
});
}The sourcemap associates the let x part of the ts with the var x part of the js. This is technically correct, but not very useful in practice. If you set a breakpoint on the let x line in chrome devtools or vscode, it actually sets a breakpoint on the var x line which runs before the await foo line. So it's practically impossible to debug this code with sourcemaps. It would be much more useful if the whole line was just sourcemapped to the x=1 line in the case.
TilmannF, lundner, Chow89, tolemac, mohsen1 and 5 more
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue