-
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
This is as minimal an example as I have for now (tsc version and tsconfig.json details at the bottom of this issue)
class A {
doIt(x: Array<string>): void {
x.forEach((v) => {
switch(v) {
case "test": console.log(this);
}
});
}
}Comparing the transpiled output from 1.8.0-dev.20151109 and 1.8.0-dev.20151110 we see:
--- app.js.1.8.0-dev.20151109 2015-11-12 16:02:01.064780316 +0000
+++ app.js.1.8.0-dev.20151110 2015-11-12 16:05:07.933061708 +0000
@@ -2,10 +2,9 @@
function A() {
}
A.prototype.doIt = function (x) {
- var _this = this;
x.forEach(function (v) {
switch (v) {
- case "test": console.log(_this);
+ case "test": console.log(this);
}
});
};This feels like a bug to me... but I might have missed something?
Thanks
message TS6029: Version 1.8.0-dev.20151110
{
"compilerOptions": {
"declaration": false,
"jsx": "react",
"module": "system",
"noImplicitAny": true,
"noLib": true,
"outDir": "../dist/",
"removeComments": false,
"rootDir": ".",
"sourceMap": true,
"target": "es5"
}
}
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