【发布时间】:2022-07-21 14:23:21
【问题描述】:
TS 装饰器
function exampleDeco(): any {
return function (
target: any,
propertyKey: string,
descriptor: PropertyDescriptor
) {
console.log(descriptor?.value, "descriptor");
return descriptor;
};
}
结果:
undefined descriptor
使用的函数
@exampleDeco()
public exampleFn = (
) => { console.log('function') }
我不知道为什么它在装饰器中记录 undefined。
【问题讨论】:
标签: node.js typescript