【发布时间】:2021-09-29 08:39:43
【问题描述】:
我在打字稿文件中创建了一个名为@Inject 的装饰器,就像这样
export class A{
@Inject()
private b!: string
@Inject()
private c!: string
}
但是 vscode 告诉我有错误
export class A{
@Inject()
private b!: string
@Inject() //error : Decorators must precede the name and all keywords of property declarations.
private c!: string
}
但是当我执行 TSC 命令时,终端并没有显示任何错误。
最奇怪的是,当我以分号结尾时,错误消失了。
export class A{
@Inject()
private b!: string ;
@Inject()
private c!: string ;
}
【问题讨论】:
标签: node.js typescript decorator