TypeScript/tests/baselines/reference/thisInInnerFunctions.types
2015-04-15 16:44:20 -07:00

51 lines
860 B
Plaintext

=== 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
};
}