TypeScript/tests/baselines/reference/thisInLambda.types

51 lines
1 KiB
Text
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/compiler/thisInLambda.ts ===
class Foo {
>Foo : Foo
x = "hello";
>x : 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
2014-08-15 23:33:16 +02:00
>a : any
class myCls {
>myCls : myCls
constructor () {
myFn(() => {
2014-08-22 03:39:46 +02:00
>myFn(() => { myFn(() => { var x = this; }); }) : void
>myFn : (a: any) => void
2014-08-22 03:39:46 +02:00
>() => { myFn(() => { var x = this; }); } : () => void
2014-08-15 23:33:16 +02:00
myFn(() => {
2014-08-22 03:39:46 +02:00
>myFn(() => { var x = this; }) : void
>myFn : (a: any) => void
2014-08-22 03:39:46 +02:00
>() => { var x = this; } : () => void
2014-08-15 23:33:16 +02:00
var x = this;
>x : myCls
>this : myCls
});
});
}
}