TypeScript/tests/cases/compiler/baseConstraintOfDecorator.ts
Wesley Wigham eba83f4ea7
Add related span for mixin constructor error (#28319)
* Add related span for mixin constructor error

* Remove unneeded casts

* Nicer style
2018-11-02 17:29:05 -07:00

19 lines
702 B
TypeScript

export function classExtender<TFunction>(superClass: TFunction, _instanceModifier: (instance: any, args: any[]) => void): TFunction {
return class decoratorFunc extends superClass {
constructor(...args: any[]) {
super(...args);
_instanceModifier(this, args);
}
};
}
class MyClass { private x; }
export function classExtender2<TFunction extends new (...args: string[]) => MyClass>(superClass: TFunction, _instanceModifier: (instance: any, args: any[]) => void): TFunction {
return class decoratorFunc extends superClass {
constructor(...args: any[]) {
super(...args);
_instanceModifier(this, args);
}
};
}