TypeScript error TS5023: unknown compiler option 'strict'

When using the strict option in a file, tsconfig.jsonI get an error message:

error TS5023: Unknown compiler option 'strict'

But this compiler option is explicitly allowed in the official documentation:

Link: https://www.typescriptlang.org/docs/handbook/compiler-options.html

As well as my Visual Studio Code Editor.

Does anyone know what I did wrong? Here is my tsconfig.json file:

{
  "compilerOptions": {
    "strict": true,
    "sourceMap":  true
  }
}
+9
source share
2 answers

You need the latest version.

In particular, you need TypeScript @> = 2.3

For installation at the project level (recommended)

npm install --dev typescript@latest

If you use tscthrough the global command line

npm install --global typescript@latest

, VS Code,

  1. ( )

    // Place your settings in this file to overwrite the default settings
    {
      "typescript.tsdk": "C:/Users/Aluan/AppData/Roaming/npm/node_modules/typescript/lib",
       //..
    
  2. Linux OSX, :

    "~/npm/node_modules/typescript/lib"
    

, VS TypesScript @> 3, , ...

:

JSPM:

:

jspm install --dev typescript@latest

VS Code:

{
  "typescript.tsdk": "./jspm_packages/npm/typescript@latest/lib"
}

:

:

yarn add --dev typescript@latest

VS Code:

{
  "typescript.tsdk": "./node_modules/typescript/lib"
}
+18

.

, tslint , tslint, tsc typescript. (, .)

- .

0

Source: https://habr.com/ru/post/1676522/


All Articles