I've started to learn how to implement TypeScript decorator in my application.
So I started with setTimeout. It's an method decorator which executes method after some time.
For example:
@Decorators.timeout()
public someMethod () {}
Here is my implementation:
export class Decorators {
public static timeout (target: Object, propertyKey: string, descriptor: TypedPropertyDescriptor<any>): any {
let originalMethod = descriptor.value;
let decArguments = arguments;
descriptor.value = function Timeout () {
setTimeout(() => {
originalMethod.apply(this, decArguments);
}, 2000);
};
return descriptor;
}
}
This is error I'm getting:
Supplied parameters do not match any signature of call target
What could be the problem?