TypeScript/tests/cases/compiler/baseConstraintOfDecorator.ts
Nathan Shively-Sanders dbaf1f6756 isConstructorType checks base constraint for undefined
Previously, it assumed there was always a base constraint, which is true
for correct code. For incorrect code, the base constraint may be
missing, which caused a crash because the base constraint was undefined.
2017-02-22 14:16:20 -08:00

9 lines
314 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);
}
};
}