I recently updated typescript, angular, and basically every library in my project. Before I did this update the problem didn't exist. From the command line I've ensured that my code builds without errors or warnings. However, when I open the project in Visual Studio Code and make changes to a file it starts highlighting stuff as errors.
It highlights my imports at the top saying cannot find module 'angular2/core'. and my @Components, @Outputs and @Inputs say Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning. It's also highlighting some of my Window properties that I have declared in a .d.ts file.
Yet this is my tsconfig.json:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"inlineSourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"noImplicitReturns": true,
"pretty": true
},
"exclude": [ "node_modules" ]
}
It seems that when I change a file VSCode is building the single file I just changed without using my tsconfig. If I build from the command line I get zero errors or warnings. If I press Ctrl+Shift+B to run the build inside VSCode then all the errors go away. Here's my tasks.json:
{
"version": "0.1.0",
"command": "tsc",
"isShellCommand": true,
"showOutput": "silent",
"args": ["-p", "."],
"problemMatcher": "$tsc"
}
How can I have VSCode look for errors and warnings using the entire project and not just the one file?
VSCode 0.10.8 typescript 1.8.7 Linux Mint 17.3 x64
Turns out that VSCode comes with it's own instance of typescript and by updating I surpassed the version that's built in.
I was notified on github that you can specify which typescript to use by adding this to your User or Workspace settings:
"typescript.tsdk": "node_modules/typescript/lib/"
This has fixed my issues.
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