1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
=== tests/cases/compiler/classMemberInitializerScoping.ts ===
var aaa = 1;
>aaa : number
>1 : 1
class CCC {
>CCC : CCC
y: number = aaa;
>y : number
>aaa : any
static staticY: number = aaa; // This shouldnt be error
>staticY : number
>aaa : number
constructor(aaa) {
>aaa : any
this.y = ''; // was: error, cannot assign string to number
>this.y = '' : ""
>this.y : number
>this : this
>y : number
>'' : ""
}
}
// above is equivalent to this:
var aaaa = 1;
>aaaa : number
>1 : 1
class CCCC {
>CCCC : CCCC
y: any;
>y : any
constructor(aaaa) {
>aaaa : any
this.y = aaaa;
>this.y = aaaa : any
>this.y : any
>this : this
>y : any
>aaaa : any
this.y = '';
>this.y = '' : ""
>this.y : any
>this : this
>y : any
>'' : ""
}
}
|