TypeScript/tests/baselines/reference/declarationEmitLocalClassDeclarationMixin.types
Ron Buckton 0d284e6c26
Add support for abstract constructor types (#36392)
* Add support for abstract constructor types

* Add backwards-compatible overloads for creating/updating constructor types

* Reverting use of 'abstract' in lib/es5.d.ts due to eslint issues

* Update baseline due to reverting lib

* Add error for failing to mark an mixin class as abstract

* Fix declaration/quick info for abstract construct signatures
2021-01-07 17:11:14 -08:00

71 lines
2.2 KiB
Plaintext

=== 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) => ((abstract 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 : ((abstract 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) => ((abstract 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
}
}