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"
]
}
}
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.
This SO answer worked for me.
Modify your .csproj file to add:
<TypeScriptExperimentalDecorators>True</TypeScriptExperimentalDecorators>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With