Na atividade 5 da aula 1 do curso de typescript 3 estou tendo dois erros ao tentar implementar o decorator:
//Creating a decorator for loging the executionTime
export function logExecutionTime() {
return function (
target: any,
propertyKey: string,
descriptor: PropertyDescriptor
) {
return descriptor;
};
}
Quando invoco o decorator no controlador dessa forma:
@logExecutionTime();
recebo as seguintes mensagens:
-Unable to resolve signature of property decorator when called as an expression.ts(1240) Decorator function return type is 'PropertyDescriptor' but is expected to be 'void' or 'any'.ts(1271)
e
-Decorator function return type is 'PropertyDescriptor' but is expected to be 'void' or 'any'.
Alguém pode me ajudar? Estou seguindo as aulas do professor @flavio