Reputation: 2375
I have common-helper.ts in my angular 6 app and i take "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning". Is my naming convention is wrong? Because when i remove "-" and change to file name to "commonhelper.ts" the error is fixing. And when i add tsconfig.json file "experimentalDecorators": true, error isn't fixing.
@Injectable({
providedIn: 'root'
})
export class CommonHelper {
constructor() { }
}
}
my tsconfig.json file
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
//"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}
Upvotes: 9
Views: 17474
Reputation: 31
For junior developers this become frustrating.
Sometimes this problem can be because of the file extension interchange between .js
and .ts
.
So kindly take a second look at your JavaScript file extension and make sure it is .ts
where it applies. Thank you.
Upvotes: 2
Reputation: 177
I had this problem in my Ionic app. Simply I had opened only the src folder from Visual Studio. You will sort the problem if you open the whole ionic folder with Visual Studio, form me the error disappeared. Point at the main folder with Visual Studio and from there navigate to ionic home.page.ts files ecc.
Upvotes: 2
Reputation: 1070
This SO answer worked for me.
Modify your .csproj file to add:
<TypeScriptExperimentalDecorators>True</TypeScriptExperimentalDecorators>
Upvotes: 12
Reputation: 196
In tsconfig.json:
"compilerOptions": {
"experimentalDecorators": true,
"allowJs": true,
...
}
Which is what every other comment/post I've scoured the internet on the subject says... and kept me frustrated... but I figured out what made the difference is:
PUT THIS AT THE VERY TOP OF COMPILER OPTIONS BEFORE ANYTHING ELSE
So something is messing it up due to ordering. Hope that helps? Put the experimentalDecorators and allowJS parameters at the very top of your object before anything else.
Upvotes: 18