When using the option "strict" in tsconfig.json
file, I get the error:
error TS5023: Unknown compiler option 'strict'
But this compiler option is clearly allowed in the official documentation:
Reference: https://www.typescriptlang.org/docs/handbook/compiler-options.html
And also my Visual Studio Code editor.
Does anyone know what I did wrong? Here is my tsconfig.json file:
{
"compilerOptions": {
"strict": true,
"sourceMap": true
}
}
You need the latest version.
Specifically, you need TypeScript@>=2.3
For project level installation (recommended)
npm install --dev typescript@latest
If you use tsc
via the global command line
npm install --global typescript@latest
To override the version used by VS Code to use your global installation
Open user settings
Change it as follows (replace my name with yours)
// Place your settings in this file to overwrite the default settings
{
"typescript.tsdk": "C:/Users/Aluan/AppData/Roaming/npm/node_modules/typescript/lib",
//..
If you are running Linux or OSX the path will be something like
"~/npm/node_modules/typescript/lib"
That said, the latest VS Code should ship with TypesScript@>3 so you shouldn't need to do anything except update it...
Other package managers:
JSPM:
command line:
jspm install --dev typescript@latest
VS Code project level settings:
{
"typescript.tsdk": "./jspm_packages/npm/typescript@latest/lib"
}
Yarn:
command line:
yarn add --dev typescript@latest
VS Code project level settings:
{
"typescript.tsdk": "./node_modules/typescript/lib"
}
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