One issue I've encountered is that when I define a parameterized decorator for a method, the decorator runs before the method itself. Ideally, I'd like the decorator to run after the method has been called.
function fooDecorator(value: boolean) {
console.log('fooDecorator initialized');
return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
};
}
class Foo{
@fooDecorator(true)
foo(){
}
}
app.listen(5000, () => console.log("server started"));
// Output
fooDecorator initialized
server started