Steps to Reproduce:
Create a Typescript project
Write the class declaration, e.g.
export class AuthService {
constructor(private http: Http) {}
}
Experimental support for decorators is a feature that is subject to change in a future release. Set the ‘experimentalDecorators’ option to remove this warning.
I have the following in my > File/preference/user settings in vscode
{
"typescript.tsdk": "node_modules/typescript/lib"
}
Also, in tsconfig.json file in the root directory of my project I have include the following options.
{
"compilerOptions": {
"experimentalDecorators": true,
"allowJs": true
}
}
Does this issue occur when all extensions are disabled?: Yes/No
Yes
In the TS file, run the TypeScript: Go to project configuration vscode command. Does this open the correct tsconfig file?
In VSCode, Go to File => Preferences => Settings (or Control+comma) and it will open the User Settings file. Add "javascript.implicitProjectConfig.experimentalDecorators": true to the file and it should fix it. It did for me.
Thanks @gondomar - that solved the issue for now..
EDIT: This was basically the issue caused by an extension called "Javascript and TypeScript Intellisense"..after disabling, the issue is resolved!
I have this issue in a javascript project where I am using es6 decorators like @inject.
example code:
@inject(UserService)
@inject(ApplicationService)
class PushService {
constructor(userService, applicationService) {
this.userService = userService;
this.applicationService = applicationService;
}
}
my jsconfig.json file is:
{
"compilerOptions": {
"experimentalDecorators": true
}
}
One of the file that gives me this "decorator" warning/error is in the path:
./server/service/src/com/tray/communication/push/PushService.js
I have already tried including and excluding the folders that I wouldn't need etc.
I tried javascript.implicitProjectConfig.experimentalDecorators: true option, but that didn't work either.
Basically, I have wasted my 3 hours trying to figure this thing out..
I don't have typescript installed locally in my project (since I am not using it at all).
Any help would be appreciated.
Thanks
Most helpful comment
In VSCode, Go to File => Preferences => Settings (or Control+comma) and it will open the User Settings file. Add "javascript.implicitProjectConfig.experimentalDecorators": true to the file and it should fix it. It did for me.