While building or running my React project I encounter the following error:
Could not parse tsconfig.json. Please make sure it contains syntactically correct JSON. Details: error TS5023: Unknown compiler option 'allowImportingTsExtensions'.
I did some research on the possible cause of the error but those couldn't help me:
For context:
The following snippet represents my tsconfig.json file:
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve",
"strictNullChecks": false,
"allowImportingTsExtensions": true
},
"include": [
"src"
]
}
Can anybody help me fix this error?
You might get this error when tsc command in the console (and in the build script) does not have the same version as what you have in VSCode.
to fix it remove the global TypeScript :
npm uninstall -g typescript
the nand reinstall it again :
npm install -g typescript