TypeScript/tests/baselines/reference/thisInLambda.types

52 lines
1 KiB
Plaintext
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/compiler/thisInLambda.ts ===
class Foo {
>Foo : Foo
2014-08-15 23:33:16 +02:00
x = "hello";
>x : string
2015-04-13 21:36:11 +02:00
>"hello" : string
2014-08-15 23:33:16 +02:00
bar() {
>bar : () => void
2014-08-15 23:33:16 +02:00
this.x; // 'this' is type 'Foo'
>this.x : string
>this : Foo
>x : string
2014-08-15 23:33:16 +02:00
var f = () => this.x; // 'this' should be type 'Foo' as well
>f : () => string
2014-08-15 23:33:16 +02:00
>() => this.x : () => string
>this.x : string
>this : Foo
>x : string
2014-08-15 23:33:16 +02:00
}
}
function myFn(a:any) { }
>myFn : (a: any) => void
>a : any
2014-08-15 23:33:16 +02:00
class myCls {
>myCls : myCls
2014-08-15 23:33:16 +02:00
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
2014-08-15 23:33:16 +02:00
});
});
}
}