Closed
Description
TypeScript Version: 2.4.1
Code
This works fine:
class Foo {
_foo: number;
foo(): this["_foo"] {
return this._foo;
}
}
This works fine:
class Foo {
protected _foo: number;
foo(): Foo["_foo"] {
return this._foo;
}
}
I expect this to work, but it does not work:
class Foo {
protected _foo: number;
foo(): this["_foo"] {
return this._foo;
}
}
It fails with this error:
(4,10): error TS2536: Type '"_foo"' cannot be used to index type 'this'.