TypeScript/tests/baselines/reference/thisInInnerFunctions.types

51 lines
860 B
Plaintext
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/compiler/thisInInnerFunctions.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
function inner() {
>inner : () => void
2014-08-15 23:33:16 +02:00
this.y = "hi"; // 'this' should be not type to 'Foo' either
>this.y = "hi" : string
>this.y : any
>this : any
>y : any
2015-04-13 21:36:11 +02:00
>"hi" : string
2014-08-15 23:33:16 +02:00
var f = () => this.y; // 'this' should be not type to 'Foo' either
>f : () => any
2014-08-15 23:33:16 +02:00
>() => this.y : () => any
>this.y : any
>this : any
>y : any
}
}
}
function test() {
>test : () => void
2014-08-15 23:33:16 +02:00
var x = () => {
>x : () => void
2014-08-22 03:39:46 +02:00
>() => { (() => this)(); this; } : () => void
2014-08-15 23:33:16 +02:00
(() => this)();
>(() => this)() : any
>(() => this) : () => any
>() => this : () => any
>this : any
this;
>this : any
};
}