TypeScript reports this error when your tsconfig.json contains a compiler option that the current TypeScript version doesn't recognize, often due to version mismatches or misconfigured option placement.
This error occurs when TypeScript encounters a compiler option in your tsconfig.json that it doesn't recognize. The error message appears as "TS5023: Unknown compiler option 'X'" where X is the name of the unrecognized option. The TypeScript compiler validates all options in your configuration file against a known list of supported compiler options. If an option doesn't match any valid option for that TypeScript version, compilation fails immediately. This is a configuration error rather than a code error, meaning your TypeScript source files are fine, but your project setup needs adjustment.
Check the error message to see which option TypeScript doesn't recognize:
error TS5023: Unknown compiler option 'verbatimModuleSyntax'.The option name is shown in single quotes. Make note of it for the next steps.
Verify which TypeScript version you're using:
npx tsc --versionAlso check your package.json to see the installed version:
npm list typescriptIf you see a version mismatch (global vs. local), always use the project-local version for consistency.
Ensure the option is in the correct location. Some options belong at the root level, not inside compilerOptions:
Root-level options (NOT in compilerOptions):
{
"include": ["src/**/*"],
"exclude": ["node_modules"],
"files": ["index.ts"],
"extends": "./base.json",
"references": [{ "path": "./other-project" }],
"compilerOptions": {
// Compiler options go here
}
}Compiler options (inside compilerOptions):
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"strict": true,
"verbatimModuleSyntax": true
}
}Move any misplaced options to their correct location.
Visit the official TSConfig Reference to check if the option exists and what version introduced it:
https://www.typescriptlang.org/tsconfig/
Search for your option and check the "Recommended" or version information. For example:
- verbatimModuleSyntax requires TypeScript 5.0+
- ignoreDeprecations requires TypeScript 5.0+
- noImplicitOverride requires TypeScript 4.3+
If the option requires a newer version than you have installed, proceed to the next step.
If the option requires a newer TypeScript version, update your project:
npm install typescript@latest --save-devFor a specific version:
npm install [email protected] --save-devAfter updating, verify the installation:
npx tsc --versionThen try compiling again:
npx tscIf you cannot update TypeScript (e.g., due to project constraints), remove the unsupported option or use an alternative:
{
"compilerOptions": {
// Remove this if TypeScript version is too old
// "verbatimModuleSyntax": true
// Use older alternatives instead
"esModuleInterop": true,
"allowSyntheticDefaultImports": true
}
}Check the TypeScript release notes to find equivalent settings for older versions.
If none of the above applies, double-check for typos:
Common typos:
- "targit" → "target"
- "moduel" → "module"
- "stict" → "strict"
Use your IDE's autocomplete when editing tsconfig.json. Most editors provide TypeScript schema validation and will highlight invalid options.
You can also validate your tsconfig.json using:
npx tsc --showConfigThis displays the resolved configuration and will error on unknown options.
Build Tool Compatibility: Some build tools and TypeScript wrappers (ts-node, esbuild, webpack's ts-loader) may not immediately support the latest TypeScript features. Even if your TypeScript version supports an option, the build tool might not parse it correctly. Check the build tool's documentation and version compatibility.
Project References: When using TypeScript project references, the "references" option must be at the root level of tsconfig.json, not inside compilerOptions. This is a common source of "Unknown compiler option" errors when migrating to monorepo setups.
Extends and Option Merging: If your tsconfig.json extends a base configuration, the unknown option might be in the base file. Check all files in the extends chain. Use tsc --showConfig to see the final merged configuration.
Version Pinning: In team environments, pin your TypeScript version in package.json to prevent version drift. Use exact versions rather than caret (^) or tilde (~) ranges:
{
"devDependencies": {
"typescript": "5.3.3"
}
}Deprecated Options: Some older options have been deprecated and removed. For example, out was removed in favor of outFile. Check TypeScript's breaking changes documentation if you're upgrading from very old versions.
Function expression requires a return type
Function expression requires a return type
Value of type 'string | undefined' is not iterable
How to fix "Value is not iterable" in TypeScript
Type 'undefined' is not assignable to type 'string'
How to fix "Type undefined is not assignable to type string" in TypeScript
Type narrowing from typeof check produces 'never'
How to fix "Type narrowing produces never" in TypeScript
Type parameter 'T' has conflicting constraints
How to fix "Type parameter has conflicting constraints" in TypeScript