I want to specify a type of target to a decorator in typescript
const dec = <T>(...): PropertyDecorator => (target: T, propertyKey) => { ... };
class SomeClass {
@dec() a: number;
}
And here the T type is unknown. I know I can specify it with generic directly with @dec<SomeClass>(), but in this case in the SomeClass @dec will always have <SomeClass>.
Is there a way to make TypeScript automatically understand what type @dec should have?