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

52 lines
1 KiB
Plaintext

=== tests/cases/compiler/thisInLambda.ts ===
class Foo {
>Foo : Foo
x = "hello";
>x : string
>"hello" : string
bar() {
>bar : () => void
this.x; // 'this' is type 'Foo'
>this.x : string
>this : Foo
>x : string
var f = () => this.x; // 'this' should be type 'Foo' as well
>f : () => string
>() => this.x : () => string
>this.x : string
>this : Foo
>x : string
}
}
function myFn(a:any) { }
>myFn : (a: any) => void
>a : any
class myCls {
>myCls : myCls
constructor () {
myFn(() => {
>myFn(() => { myFn(() => { var x = this; }); }) : void
>myFn : (a: any) => void
>() => { myFn(() => { var x = this; }); } : () => void
myFn(() => {
>myFn(() => { var x = this; }) : void
>myFn : (a: any) => void
>() => { var x = this; } : () => void
var x = this;
>x : myCls
>this : myCls
});
});
}
}