Open
Description
› tsc --version
Version 2.7.0-dev.20171020
Code
tsconfig.json:
{
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"noEmit": true,
"strict": true
},
"files": [
"index.d.ts",
"index.js"
]
}
index.js:
/** @type {MyObj} */
const o = {
foo: function() {
(function() {
console.log(this); // <- Unexpected error here.
}.bind(this))();
}
};
index.d.ts:
interface MyObj {
foo(this: { a: number }): void;
}
How it looks in the editor:
But context passed to the nested function is lost:
Expected behavior:
There should not be error, because this
explicitly specified by .bind()
.
Actual behavior:
› tsc
index.js(5,25): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.