Reputation: 105439
The ClassDecorator
is defined as:
declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;
I've written it like that:
export function ClassDecorator(params: any): ClassDecorator {
return function (target) {
Object.seal(target);
Object.seal(target.prototype);
}
}
But the compiler gives me an error:
Error:(2, 12) TS2322:Type '(target: any, key: any, descriptor: any) => void' is not assignable to type 'ClassDecorator'.
Why?
Upvotes: 1
Views: 276
Reputation: 14493
The type ClassDecorator
is defined to be a function that takes one argument, you return a function that takes three arguments, that is not compatible and that is why you get the error message.
Upvotes: 1