typescript装饰器报错 为何ts的装饰器不能被赋值或导出?

image.png
image.png
注意这里报错
修改语法为装饰器+类声明则报错消失 ,这与ECMAScript中的语法行为并不一致
image.png
如何做到export const Compo = @decorator class {}且通过ts类型检查?求指点
image.png
(并不想写
@decor class App {};
export {App as Compo}
这样的代码
)

阅读 4.6k
1 个回答
✓ 已被采纳新手上路,请多包涵

我已经知道了 ts中装饰器的语法是这样的
image.png

推荐问题