Answer the question
In order to leave comments, you need to log in
How to properly type a method decorator?
Good afternoon. Tell me how to type the Compute method
class SomeClass {
foo: string;
bar: string
@Compute(['foo', 'bar'])
fooBar({
foo,
bar,
}): void {}
}
export function Compute<
T extends { [key: string]: any; },
K extends keyof T = keyof T
>( reactiveInputs: K[], reactiveDependency: K[] = [] ): (
target: T,
propertyKey: string,
descriptor: TypedPropertyDescriptor<(newValues: Pick<T, K>) => void>
) => any {
return (target, name, descriptor) => {}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question