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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
=== tests/cases/compiler/interfaceImplementation1.ts ===
interface I1 {
iObj:{ };
>iObj : {}
iNum:number;
>iNum : number
iAny:any;
>iAny : any
iFn():void;
>iFn : () => void
}
interface I2 {
iFn(n:number, s:string):void;
>iFn : (n: number, s: string) => void
>n : number
>s : string
}
class C1 implements I1,I2 {
>C1 : C1
private iFn();
>iFn : () => any
private iFn(n?:number, s?:string) { }
>iFn : () => any
>n : number
>s : string
private iAny:any;
>iAny : any
private iNum:number;
>iNum : number
private iObj:{ };
>iObj : {}
}
interface I3 {
x: number;
>x : number
}
interface I4 {
():I3;
new ():I3;
[call:number]:string;
>call : number
}
class C2 implements I3 {
>C2 : C2
public x = 1;
>x : number
>1 : 1
}
var a:I4 = function(){
>a : I4
>function(){ return new C2();} : () => C2
return new C2();
>new C2() : C2
>C2 : typeof C2
}
new a();
>new a() : I3
>a : I4
/*var b:I4 = C2;
new b();
*/
var c:I4;
>c : I4
c[5];
>c[5] : string
>c : I4
>5 : 5
c["foo"];
>c["foo"] : any
>c : I4
>"foo" : "foo"
|