I created a decorator called @Inject in typescript file, like this
export class A{
@Inject()
private b!: string
@Inject()
private c!: string
}
But vscode told me there was a mistake
export class A{
@Inject()
private b!: string
@Inject() //error : Decorators must precede the name and all keywords of property declarations.
private c!: string
}
But when I execute the TSC command, the terminal does not display any errors.
The strangest thing is that when I end with a semicolon, the error disappears.
export class A{
@Inject()
private b!: string ;
@Inject()
private c!: string ;
}
you must to change version typescript in visual studio code. for me version typescript is 4.3.2
You need to search after your Typescript version and change it to your current workspace version instead of the vscode typescript version which is currently a dev verison.
First search after >Typescript: Version
Than you can selest the current workspace verison
You also can click on the bottom right corner on the typscript version and change it to your current workspace version.