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
|
=== tests/cases/compiler/declarationEmitLocalClassDeclarationMixin.ts ===
interface Constructor<C> { new (...args: any[]): C; }
>args : any[]
function mixin<B extends Constructor<{}>>(Base: B) {
>mixin : <B extends Constructor<{}>>(Base: B) => { new (...args: any[]): PrivateMixed; prototype: mixin<any>.PrivateMixed; } & B
>Base : B
class PrivateMixed extends Base {
>PrivateMixed : PrivateMixed
>Base : {}
bar = 2;
>bar : number
>2 : 2
}
return PrivateMixed;
>PrivateMixed : { new (...args: any[]): PrivateMixed; prototype: mixin<any>.PrivateMixed; } & B
}
export class Unmixed {
>Unmixed : Unmixed
foo = 1;
>foo : number
>1 : 1
}
export const Mixed = mixin(Unmixed);
>Mixed : { new (...args: any[]): mixin<typeof Unmixed>.PrivateMixed; prototype: mixin<any>.PrivateMixed; } & typeof Unmixed
>mixin(Unmixed) : { new (...args: any[]): mixin<typeof Unmixed>.PrivateMixed; prototype: mixin<any>.PrivateMixed; } & typeof Unmixed
>mixin : <B extends Constructor<{}>>(Base: B) => { new (...args: any[]): PrivateMixed; prototype: mixin<any>.PrivateMixed; } & B
>Unmixed : typeof Unmixed
function Filter<C extends Constructor<{}>>(ctor: C) {
>Filter : <C extends Constructor<{}>>(ctor: C) => { new (...args: any[]): FilterMixin; prototype: Filter<any>.FilterMixin; } & C
>ctor : C
abstract class FilterMixin extends ctor {
>FilterMixin : FilterMixin
>ctor : {}
abstract match(path: string): boolean;
>match : (path: string) => boolean
>path : string
// other concrete methods, fields, constructor
thing = 12;
>thing : number
>12 : 12
}
return FilterMixin;
>FilterMixin : { new (...args: any[]): FilterMixin; prototype: Filter<any>.FilterMixin; } & C
}
export class FilteredThing extends Filter(Unmixed) {
>FilteredThing : FilteredThing
>Filter(Unmixed) : Filter<typeof Unmixed>.FilterMixin & Unmixed
>Filter : <C extends Constructor<{}>>(ctor: C) => { new (...args: any[]): FilterMixin; prototype: Filter<any>.FilterMixin; } & C
>Unmixed : typeof Unmixed
match(path: string) {
>match : (path: string) => boolean
>path : string
return false;
>false : false
}
}
|