50 lines
860 B
Text
50 lines
860 B
Text
=== tests/cases/compiler/thisInInnerFunctions.ts ===
|
|
class Foo {
|
|
>Foo : Foo
|
|
|
|
x = "hello";
|
|
>x : string
|
|
>"hello" : string
|
|
|
|
bar() {
|
|
>bar : () => void
|
|
|
|
function inner() {
|
|
>inner : () => void
|
|
|
|
this.y = "hi"; // 'this' should be not type to 'Foo' either
|
|
>this.y = "hi" : string
|
|
>this.y : any
|
|
>this : any
|
|
>y : any
|
|
>"hi" : string
|
|
|
|
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
|
|
|
|
};
|
|
}
|
|
|