As mentioned in #2249 (comment), consider this:
// decorator factory
function F(options?: {optional: boolean}) {
// returns a property decorator
return (target , propertyKey): void => {
// decorator implementation
}
}
class C {
@F() // OK, used as a factory
prop1;
@F // No error
prop2;
}
The problem here is that the compiler compares the signature of the decorator factory F against declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; which ends up to be assignable. I think we need a stronger check here to make sure we catch these issue.
As mentioned in #2249 (comment), consider this:
The problem here is that the compiler compares the signature of the decorator factory
Fagainstdeclare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;which ends up to be assignable. I think we need a stronger check here to make sure we catch these issue.