1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
=== tests/cases/compiler/thisInInnerFunctions.ts ===
class Foo {
>Foo : Foo
x = "hello";
>x : string
>"hello" : "hello"
bar() {
>bar : () => void
function inner() {
>inner : () => void
this.y = "hi"; // 'this' should be not type to 'Foo' either
>this.y = "hi" : "hi"
>this.y : any
>this : any
>y : any
>"hi" : "hi"
var f = () => this.y; // 'this' should be not type to 'Foo' either
>f : () => any
>() => this.y : () => any
>this.y : any
>this : any
>y : any
}
}
}
function test() {
>test : () => void
var x = () => {
>x : () => void
>() => { (() => this)(); this; } : () => void
(() => this)();
>(() => this)() : any
>(() => this) : () => any
>() => this : () => any
>this : any
this;
>this : any
};
}
|