I'm using the typescript but I use it through webpack and babel, so in my ts code imports should be commented out:
// import * as $ from 'jquery';
Otherwise I get errors on babel side. I can't find better way. This works.
But then VS 2019 INTELLISENSE start reporting me many errors:
And I can't do anything with this. Doesn't work
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
Possibly because of they are not MSBuild error, but Interllisense.
I have removed the
<TypeScriptToolsVersion>4.1</TypeScriptToolsVersion>
Then VS shows me the warning "please install typescript" and... the same errors list. Possibly because VS ignores it if obtain the tsconfig.json (which I steel need, babel uses it).
Unload/Reload project doesn't help.
How to instruct intellisense do not show me TS2581 and TS2503 at least as errors ?
This does not answer your question directly but could be helpful.
If your like me and have node_modules
some of them have tsconfig.json
files which visual studio will pick up automatically. it appears to be a solution wide search. Visual studio will then try to run the TSC automatically on it which will throw errors depending on the module. I think it's mostly related to the dev dependencies not being installed.
vs-tsconfig-fix.js
I added a post build step to my package.json
that will just go around and delete the tsconfig.json
file from any node_modules
.
I think it should be find for most modules to delete this because most of them are already transpiled for you
in your tsconfig.json
file ensure you have the exclude node_modules
and you should not get any intelisense errors.
You might still get the errors if you open the files from node_modules
but from my testing if you close it the errors will disappear.
TL;DR running this script will delete all tsconfig.json
from node_modules
which visual studio is picking up
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