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
|
=== tests/cases/compiler/mixingApparentTypeOverrides.ts ===
type Constructor<T> = new(...args: any[]) => T;
>Constructor : Constructor<T>
>args : any[]
function Tagged<T extends Constructor<{}>>(Base: T) {
>Tagged : <T extends Constructor<{}>>(Base: T) => { new (...args: any[]): (Anonymous class); prototype: Tagged<any>.(Anonymous class); } & T
>Base : T
return class extends Base {
>class extends Base { _tag: string; constructor(...args: any[]) { super(...args); this._tag = ""; } } : { new (...args: any[]): (Anonymous class); prototype: Tagged<any>.(Anonymous class); } & T
>Base : {}
_tag: string;
>_tag : string
constructor(...args: any[]) {
>args : any[]
super(...args);
>super(...args) : void
>super : T
>...args : any
>args : any[]
this._tag = "";
>this._tag = "" : ""
>this._tag : string
>this : this
>_tag : string
>"" : ""
}
};
}
class A {
>A : A
toString () {
>toString : () => string
return "class A";
>"class A" : "class A"
}
}
class B extends Tagged(A) {
>B : B
>Tagged(A) : Tagged<typeof A>.(Anonymous class) & A
>Tagged : <T extends Constructor<{}>>(Base: T) => { new (...args: any[]): (Anonymous class); prototype: Tagged<any>.(Anonymous class); } & T
>A : typeof A
toString () { // Should not be an error
>toString : () => string
return "class B";
>"class B" : "class B"
}
}
class C extends A {
>C : C
>A : A
toString () { // Should not be an error
>toString : () => string
return "class C";
>"class C" : "class C"
}
}
|