Reputation: 2051
The type script code I am writing compiles just fine. The issue is in visual studio code I see the following warning.
There is a similar question on SO to this but that is for compiling tyepscript which works . I just see the above warning and I cannot figure out how to turn it off.
I read update your tsconfig.json but as far as I can tell mine is correct.
My tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es2017",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2016",
"dom"
]
}
}
Upvotes: 1
Views: 1843
Reputation: 2051
If you create an application via the angular cli, ng new project, it will create two tsconfig.json one in the root folder of the project and one in the src folder. Web pack when calling ng serve uses the tsconfig.json in the root of the project while vscode uses the one in the src folder.
|-tsconfig.json
|-src
|-tsconfig.json
To resolve: update the compiler options for the tsconfig.json in the src folder as follows
add "target": "es2017"
{
"compilerOptions": {
"experimentalDecorators": true,
"allowJs": true,
"target": "es2017"
}
}
Upvotes: 3