Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript does not emit names in sourcemap. This breaks this -> _this hover when debugging #14688

Closed
nojvek opened this issue Mar 16, 2017 · 3 comments
Labels
Duplicate An existing issue was already created

Comments

@nojvek
Copy link
Contributor

nojvek commented Mar 16, 2017

TypeScript Version: 2.2.1 / nightly (2.2.0-dev.201xxxxx)
v2.2.1
Code

// A *self-contained* demonstration of the problem follows...
const test = (inp: string[]) => {
    console.log(this);
    for (let str of inp) {
        console.log(str);
    }
}

test(['1', '2', '3', '4'])

output:

var _this = this;
var test = function (inp) {
    console.log(_this);
    for (var _i = 0, inp_1 = inp; _i < inp_1.length; _i++) {
        var str = inp_1[_i];
        console.log(str);
    }
};
test(['1', '2', '3', '4']);
//# sourceMappingURL=blah.js.map

Sourcemap:

{"version":3,"file":"blah.js","sourceRoot":"","sources":["blah.ts"],"names":[],
"mappings":"AAAA,iBAO0B;AAP1B,IAAM,IAAI,GAAG,UAAC,GAAa;IACvB,OAAO,CAAC,GAAG,CAAC,KAAI,CAAC,CAAC;IAClB,GAAG,CAAC,CAAY,UAAG,EAAH,WAAG,EAAH,iBAAG,EAAH,IAAG;QAAd,IAAI,GAAG,YAAA;QACR,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;KACpB;AACL,CAAC,CAAA;AAED,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA"}

Expected behavior:
names:[] should be filled with the transpiled names. This breaks debuggers that try to show values when hovering over the variable name. In many cases this in scope refer to _this or _this1 or _this12.

See microsoft/vscode#12066 (comment)

Having names would aid VSCode in giving a better experience for debugging transpiled typescript output

Actual behavior:

names is always empty.

@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label May 24, 2017
@JasonKleban
Copy link

Can this be put on the roadmap?

@mhegazy
Copy link
Contributor

mhegazy commented Jan 10, 2018

this is a duplicate of #9627

@mhegazy mhegazy added Duplicate An existing issue was already created and removed Needs Investigation This issue needs a team member to investigate its status. labels Jan 10, 2018
@typescript-bot
Copy link
Collaborator

Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.

@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

5 participants