我试图在运行时在类装饰器中获取类的名称(缩小!)。
当我这样做时:
const metadata = Reflect.getMetadata('design:type', target.constructor);
我变得不确定。我需要知道类名而不是缩小值。我认为 TSC 会写入有关类名称的元数据信息,但我找不到任何相关证据。
I have
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
set
您基本上是在寻找 nameof 运算符,不幸的是它尚未实现:https://github.com/microsoft/TypeScript/issues/1579 https://github.com/microsoft/TypeScript/issues/1579
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)