Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vscode doesn't show typescript errors if file isn't opened

I'm using typescript on react native. When there is an error in one of my files, vscode doesn't show it in "Problems" tab unless I've that file opened.

Before Opening the file: File not opened

After Opening the file: File is opened

tsconfig.json:

{
  "extends": "@tsconfig/react-native/tsconfig.json"
}

@tsconfig/react-native/tsconfig.json:

{
  "$schema": "https://json.schemastore.org/tsconfig",
  "display": "React Native",
  "_version": "2.0.3",
  "compilerOptions": {
    "target": "esnext",
    "module": "commonjs",
    "types": ["react-native", "jest"],
    "lib": [
      "es2019"
    ],
    "allowJs": true,
    "jsx": "react-native",
    "noEmit": true,
    "isolatedModules": true,
    "strict": true,
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "allowSyntheticDefaultImports": true,
    "forceConsistentCasingInFileNames": true,
    "esModuleInterop": true,
    "skipLibCheck": true
  },
  "exclude": [
    "node_modules",
    "babel.config.js",
    "metro.config.js",
    "jest.config.js"
  ]
}

What do I do such that all errors are shown in problem tab and the files in sidebar have red underlines?

like image 568
Tayyab Mazhar Avatar asked Aug 26 '26 08:08

Tayyab Mazhar


1 Answers

  1. Press Cmd+Shift+P.
  2. Search for "open user settings (json)" and open the settings.json file.
  3. Add this line there:
    "typescript.tsserver.experimental.enableProjectDiagnostics": true,
    

This is still an experimental feature. You can track this feature request on GitHub for updates.

like image 140
brc-dd Avatar answered Aug 28 '26 08:08

brc-dd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!