Closed
Description
// ./foo.ts
class Foo {
constructor() {
this.foo = "Hello";
}
slicey() {
this.foo = this.foo.slice();
}
}
// ./tsconfig.json
{
"compilerOptions": { "strict": true },
"files": ["./foo.ts"]
}
Current Behavior
'foo' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.ts(7022)
Proposed Behavior
If an implicit any
is going to be inferred, but foo
has an initializer in the constructor, it should always infer the type from the initializer.