I have a project that looks like this:
In the root tsconfig.json
file, I’ve set strictNullCheck: true
But in the nested tsconfig.app.json
file under apps/app-not-strict/tsconfig.app.json
I’ve set strictNullCheck: false
.
When I build the app with tsc
I do not get any errors – as expected, since inside the nested tsconfig.json
the strict configuration is relaxed.
However, inside app-not-strict, I get an editor error:
How can I configure vscode to respect the nested tsconfig.app.json
configuration?
I expect vscode to be aligned with build and not show errors if build is passing.
I also noticed that if i renamed tsconfig.app.json to tsconfig.json all is working as expected.
Note: Here is a repo that shows the issue:
https://github.com/Gorthog/vscode-typescript-issue
There is a known issue with vscode that it only respects tsconfig.json:
https://github.com/microsoft/vscode/issues/12463
Best workaround I’ve found so far – Create a tsconfig.json file that extends the other tsconfig.app.json file. It also means that you need to separate app and test code into two different folders. Annoying, but works.