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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
=== tests/cases/compiler/interfaceClassMerging.ts ===
interface Foo {
>Foo : Foo
method(a: number): string;
>method : (a: number) => string
>a : number
optionalMethod?(a: number): string;
>optionalMethod : (a: number) => string
>a : number
property: string;
>property : string
optionalProperty?: string;
>optionalProperty : string
}
class Foo {
>Foo : Foo
additionalProperty: string;
>additionalProperty : string
additionalMethod(a: number): string {
>additionalMethod : (a: number) => string
>a : number
return this.method(0);
>this.method(0) : string
>this.method : (a: number) => string
>this : this
>method : (a: number) => string
>0 : 0
}
}
class Bar extends Foo {
>Bar : Bar
>Foo : Foo
method(a: number) {
>method : (a: number) => string
>a : number
return this.optionalProperty;
>this.optionalProperty : string
>this : this
>optionalProperty : string
}
}
var bar = new Bar();
>bar : Bar
>new Bar() : Bar
>Bar : typeof Bar
bar.method(0);
>bar.method(0) : string
>bar.method : (a: number) => string
>bar : Bar
>method : (a: number) => string
>0 : 0
bar.optionalMethod(1);
>bar.optionalMethod(1) : string
>bar.optionalMethod : (a: number) => string
>bar : Bar
>optionalMethod : (a: number) => string
>1 : 1
bar.property;
>bar.property : string
>bar : Bar
>property : string
bar.optionalProperty;
>bar.optionalProperty : string
>bar : Bar
>optionalProperty : string
bar.additionalProperty;
>bar.additionalProperty : string
>bar : Bar
>additionalProperty : string
bar.additionalMethod(2);
>bar.additionalMethod(2) : string
>bar.additionalMethod : (a: number) => string
>bar : Bar
>additionalMethod : (a: number) => string
>2 : 2
var obj: {
>obj : { method(a: number): string; property: string; additionalProperty: string; additionalMethod(a: number): string; }
method(a: number): string;
>method : (a: number) => string
>a : number
property: string;
>property : string
additionalProperty: string;
>additionalProperty : string
additionalMethod(a: number): string;
>additionalMethod : (a: number) => string
>a : number
};
bar = obj;
>bar = obj : { method(a: number): string; property: string; additionalProperty: string; additionalMethod(a: number): string; }
>bar : Bar
>obj : { method(a: number): string; property: string; additionalProperty: string; additionalMethod(a: number): string; }
obj = bar;
>obj = bar : Bar
>obj : { method(a: number): string; property: string; additionalProperty: string; additionalMethod(a: number): string; }
>bar : Bar
|