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