Overview
This page provides a comprehensive reference for all TypeScript compiler options extracted from the TypeScript source code (src/compiler/commandLineParser.ts).
All compiler options are specified in the
compilerOptions section of your tsconfig.json file.Language and Environment
Options that affect the JavaScript language version and runtime environment.target
Set the JavaScript language version for emitted JavaScript and include compatible library declarations.Type:
"es3" | "es5" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "es2023" | "es2024" | "es2025" | "esnext"Shorthand: -tSource: src/compiler/commandLineParser.ts:572-602lib
Specify a set of bundled library declaration files that describe the target runtime environment.Common values:
es5, es2015, es2020, esnext, dom, dom.iterable, webworker, scripthostSource: src/compiler/commandLineParser.ts:704-717All available lib options
All available lib options
JavaScript versions:
es5,es6/es2015,es2016,es2017,es2018,es2019,es2020,es2021,es2022,es2023,es2024,es2025,esnext
dom,dom.iterable,dom.asynciterablewebworker,webworker.importscripts,webworker.iterable,webworker.asynciterablescripthost
es2015.promise, es2020.bigint, esnext.decorators)Source: src/compiler/commandLineParser.ts:151-265jsx
Specify what JSX code is generated.Type:
"preserve" | "react-native" | "react" | "react-jsx" | "react-jsxdev"Source: src/compiler/commandLineParser.ts:740-755jsxFactory
Specify the JSX factory function used when targeting React JSX emit.Source:
src/compiler/commandLineParser.ts:1336-1341jsxFragmentFactory
Specify the JSX Fragment reference used for fragments when targeting React JSX emit.Source:
src/compiler/commandLineParser.ts:1343-1348jsxImportSource
Specify module specifier used to import the JSX factory functions when using
jsx: react-jsx*.Source: src/compiler/commandLineParser.ts:1350-1360moduleDetection
Control what method is used to detect module-format JS files.Type:
"auto" | "legacy" | "force"Source: src/compiler/commandLineParser.ts:1671-1682experimentalDecorators
Enable experimental support for legacy experimental decorators.Source:
src/compiler/commandLineParser.ts:1314-1322emitDecoratorMetadata
Emit design-type metadata for decorated declarations in source files.Source:
src/compiler/commandLineParser.ts:1324-1332noLib
Disable including any library files including the default lib.d.ts.Source:
src/compiler/commandLineParser.ts:1448-1457useDefineForClassFields
Emit ECMAScript-standard-compliant class fields.Source:
src/compiler/commandLineParser.ts:1632-1640Modules
Options that affect module resolution and output.module
Specify what module code is generated.Type:
"none" | "commonjs" | "amd" | "system" | "umd" | "es6" | "es2015" | "es2020" | "es2022" | "esnext" | "node16" | "nodenext" | "preserve"Shorthand: -mSource: src/compiler/commandLineParser.ts:605-635moduleResolution
Specify how TypeScript looks up a file from a given module specifier.Type:
"node10" | "node" | "classic" | "node16" | "nodenext" | "bundler"Default: "nodenext" if module is nodenext, "node16" if module is node16, otherwise "bundler"Source: src/compiler/commandLineParser.ts:1097-1114baseUrl
Specify the base directory to resolve non-relative module names.Source:
src/compiler/commandLineParser.ts:1116-1122paths
Specify a set of entries that re-map imports to additional lookup locations.Source:
src/compiler/commandLineParser.ts:1126-1134rootDir
Specify the root folder within your source files.Default: Computed from the list of input filesSource:
src/compiler/commandLineParser.ts:782-792rootDirs
Allow multiple folders to be treated as one when resolving modules.Source:
src/compiler/commandLineParser.ts:1138-1152typeRoots
Specify multiple folders that act like
./node_modules/@types.Source: src/compiler/commandLineParser.ts:1154-1165types
Specify type package names to be included without being referenced in a source file.Source:
src/compiler/commandLineParser.ts:1167-1178resolveJsonModule
Enable importing .json files.Source:
src/compiler/commandLineParser.ts:1362-1368resolvePackageJsonExports
Use the package.json ‘exports’ field when resolving package imports.Source:
src/compiler/commandLineParser.ts:1247-1253resolvePackageJsonImports
Use the package.json ‘imports’ field when resolving imports.Source:
src/compiler/commandLineParser.ts:1255-1261customConditions
Conditions to set in addition to the resolver-specific defaults when resolving imports.Source:
src/compiler/commandLineParser.ts:1263-1272moduleSuffixes
List of file name suffixes to search when resolving a module.Source:
src/compiler/commandLineParser.ts:1216-1226allowImportingTsExtensions
Allow imports to include TypeScript file extensions. Requires
--moduleResolution bundler and either --noEmit or --emitDeclarationOnly.Source: src/compiler/commandLineParser.ts:1228-1236rewriteRelativeImportExtensions
Rewrite
.ts, .tsx, .mts, and .cts file extensions in relative import paths to their JavaScript equivalent in output files.Source: src/compiler/commandLineParser.ts:1238-1245allowArbitraryExtensions
Enable importing files with any extension, provided a declaration file is present.Source:
src/compiler/commandLineParser.ts:1370-1376noResolve
Disallow
imports, requires, or <reference>s from expanding the number of files TypeScript should add to a project.Source: src/compiler/commandLineParser.ts:1459-1468noUncheckedSideEffectImports
Check side effect imports.Source:
src/compiler/commandLineParser.ts:1274-1281Emit
Options that affect JavaScript emit.outFile
Specify a file that bundles all outputs into one JavaScript file. If
declaration is true, also designates a file that bundles all .d.ts output.Source: src/compiler/commandLineParser.ts:757-768outDir
Specify an output folder for all emitted files.Source:
src/compiler/commandLineParser.ts:770-780declaration
Generate .d.ts files from TypeScript and JavaScript files in your project.Shorthand:
-dSource: src/compiler/commandLineParser.ts:477-487declarationMap
Create sourcemaps for d.ts files.Source:
src/compiler/commandLineParser.ts:489-497declarationDir
Specify the output directory for generated declaration files.Source:
src/compiler/commandLineParser.ts:1548-1558emitDeclarationOnly
Only output d.ts files and not JavaScript files.Source:
src/compiler/commandLineParser.ts:499-508sourceMap
Create source map files for emitted JavaScript files.Source:
src/compiler/commandLineParser.ts:510-518inlineSourceMap
Include sourcemap files inside the emitted JavaScript.Source:
src/compiler/commandLineParser.ts:520-527sourceRoot
Specify the root path for debuggers to find the reference source code.Source:
src/compiler/commandLineParser.ts:1285-1292mapRoot
Specify the location where debugger should locate map files instead of generated locations.Source:
src/compiler/commandLineParser.ts:1294-1301inlineSources
Include source code in the sourcemaps inside the emitted JavaScript.Source:
src/compiler/commandLineParser.ts:1303-1310removeComments
Disable emitting comments.Source:
src/compiler/commandLineParser.ts:817-825noEmit
Disable emitting files from a compilation.Source:
src/compiler/commandLineParser.ts:539-546noEmitOnError
Disable emitting files if any type checking errors are reported.Source:
src/compiler/commandLineParser.ts:1529-1537noEmitHelpers
Disable generating custom helper functions like
__extends in compiled output.Source: src/compiler/commandLineParser.ts:1520-1527importHelpers
Allow importing helper functions from tslib once per project, instead of including them per-file.Source:
src/compiler/commandLineParser.ts:827-835importsNotUsedAsValues
Specify emit/checking behavior for imports that are only used for types.Type:
"remove" | "preserve" | "error"Source: src/compiler/commandLineParser.ts:837-849downlevelIteration
Emit more compliant, but verbose and less performant JavaScript for iteration.Source:
src/compiler/commandLineParser.ts:851-858preserveConstEnums
Disable erasing
const enum declarations in generated code.Source: src/compiler/commandLineParser.ts:1539-1546stripInternal
Disable emitting declarations that have
@internal in their JSDoc comments.Source: src/compiler/commandLineParser.ts:1470-1477newLine
Set the newline character for emitting files.Type:
"crlf" | "lf"Source: src/compiler/commandLineParser.ts:1426-1437emitBOM
Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.Source:
src/compiler/commandLineParser.ts:1417-1424Type Checking
Options that affect type checking behavior.strict
Enable all strict type-checking options.Source:
src/compiler/commandLineParser.ts:906-917noImplicitAny
Enable error reporting for expressions and declarations with an implied
any type.Source: src/compiler/commandLineParser.ts:919-927strictNullChecks
When type checking, take into account
null and undefined.Source: src/compiler/commandLineParser.ts:929-937strictFunctionTypes
When assigning functions, check to ensure parameters and the return values are subtype-compatible.Source:
src/compiler/commandLineParser.ts:939-947strictBindCallApply
Check that the arguments for
bind, call, and apply methods match the original function.Source: src/compiler/commandLineParser.ts:949-957strictPropertyInitialization
Check for class properties that are declared but not set in the constructor.Source:
src/compiler/commandLineParser.ts:959-967strictBuiltinIteratorReturn
Built-in iterators are instantiated with a
TReturn type of undefined instead of any.Source: src/compiler/commandLineParser.ts:969-977noImplicitThis
Enable error reporting when
this is given the type any.Source: src/compiler/commandLineParser.ts:989-997useUnknownInCatchVariables
Default catch clause variables as
unknown instead of any.Source: src/compiler/commandLineParser.ts:999-1007alwaysStrict
Ensure ‘use strict’ is always emitted.Source:
src/compiler/commandLineParser.ts:1009-1017noUnusedLocals
Enable error reporting when local variables aren’t read.Source:
src/compiler/commandLineParser.ts:1021-1028noUnusedParameters
Raise an error when a function parameter isn’t read.Source:
src/compiler/commandLineParser.ts:1030-1037exactOptionalPropertyTypes
Interpret optional property types as written, rather than adding
undefined.Source: src/compiler/commandLineParser.ts:1039-1046noImplicitReturns
Enable error reporting for codepaths that do not explicitly return in a function.Source:
src/compiler/commandLineParser.ts:1048-1055noFallthroughCasesInSwitch
Enable error reporting for fallthrough cases in switch statements.Source:
src/compiler/commandLineParser.ts:1057-1065noUncheckedIndexedAccess
Add
undefined to a type when accessed using an index.Source: src/compiler/commandLineParser.ts:1067-1074noImplicitOverride
Ensure overriding members in derived classes are marked with an override modifier.Source:
src/compiler/commandLineParser.ts:1076-1083noPropertyAccessFromIndexSignature
Enforces using indexed accessors for keys declared using an indexed type.Source:
src/compiler/commandLineParser.ts:1085-1093allowUnusedLabels
Disable error reporting for unused labels.Source:
src/compiler/commandLineParser.ts:1569-1577allowUnreachableCode
Disable error reporting for unreachable code.Source:
src/compiler/commandLineParser.ts:1579-1587noErrorTruncation
Disable truncating types in error messages.Source:
src/compiler/commandLineParser.ts:1439-1446suppressExcessPropertyErrors
Disable reporting of excess property errors during the creation of object literals.Source:
src/compiler/commandLineParser.ts:1589-1596suppressImplicitAnyIndexErrors
Suppress
noImplicitAny errors when indexing objects that lack index signatures.Source: src/compiler/commandLineParser.ts:1598-1605noStrictGenericChecks
Disable strict checking of generic signatures in function types.Source:
src/compiler/commandLineParser.ts:1623-1630JavaScript Support
Options for JavaScript files.allowJs
Allow JavaScript files to be a part of your program. Use the
checkJs option to get errors from these files.Source: src/compiler/commandLineParser.ts:719-727checkJs
Enable error reporting in type-checked JavaScript files.Source:
src/compiler/commandLineParser.ts:729-738maxNodeModuleJsDepth
Specify the maximum folder depth used for checking JavaScript files from
node_modules. Only applicable with allowJs.Source: src/compiler/commandLineParser.ts:1615-1621Interop Constraints
Options that ensure compatibility between different module systems.isolatedModules
Ensure that each file can be safely transpiled without relying on other imports.Source:
src/compiler/commandLineParser.ts:860-866verbatimModuleSyntax
Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file’s format based on the ‘module’ setting.Source:
src/compiler/commandLineParser.ts:868-876isolatedDeclarations
Require sufficient annotation on exports so other tools can trivially generate declaration files.Source:
src/compiler/commandLineParser.ts:878-885allowSyntheticDefaultImports
Allow ‘import x from y’ when a module doesn’t have a default export.Source:
src/compiler/commandLineParser.ts:1180-1187esModuleInterop
Emit additional JavaScript to ease support for importing CommonJS modules. This enables
allowSyntheticDefaultImports for type compatibility.Source: src/compiler/commandLineParser.ts:1189-1198preserveSymlinks
Disable resolving symlinks to their realpath. This correlates to the same flag in node.Source:
src/compiler/commandLineParser.ts:1200-1205forceConsistentCasingInFileNames
Ensure that casing is correct in imports.Source:
src/compiler/commandLineParser.ts:1607-1613allowUmdGlobalAccess
Allow accessing UMD globals from modules.Source:
src/compiler/commandLineParser.ts:1207-1214Projects
Options for project references and build configuration.incremental
Save .tsbuildinfo files to allow for incremental compilation of projects.Shorthand:
-iSource: src/compiler/commandLineParser.ts:468-475composite
Enable constraints that allow a TypeScript project to be used with project references.Source:
src/compiler/commandLineParser.ts:794-803tsBuildInfoFile
Specify the path to .tsbuildinfo incremental compilation file.Source:
src/compiler/commandLineParser.ts:805-815disableSourceOfProjectReferenceRedirect
Disable preferring source files instead of declaration files when referencing composite projects.Source:
src/compiler/commandLineParser.ts:1487-1493disableSolutionSearching
Opt a project out of multi-project reference checking when editing.Source:
src/compiler/commandLineParser.ts:1495-1501disableReferencedProjectLoad
Reduce the number of projects loaded automatically by TypeScript.Source:
src/compiler/commandLineParser.ts:1503-1509Completeness
Options for improving completeness of type checking.skipLibCheck
Skip type checking all .d.ts files.Source:
src/compiler/commandLineParser.ts:1560-1567skipDefaultLibCheck
Skip type checking .d.ts files that are included with TypeScript.Source:
src/compiler/commandLineParser.ts:1401-1408Backwards Compatibility
Options for backwards compatibility with older TypeScript versions.charset
No longer supported. In early versions, manually set the text encoding for reading files.Source:
src/compiler/commandLineParser.ts:1410-1415keyofStringsOnly
Make keyof only return strings instead of string, numbers or symbols. Legacy option.Source:
src/compiler/commandLineParser.ts:1652-1657noImplicitUseStrict
Disable adding ‘use strict’ directives in emitted JavaScript files.Source:
src/compiler/commandLineParser.ts:1511-1518out
Deprecated setting. Use
outFile instead.Source: src/compiler/commandLineParser.ts:1379-1390preserveValueImports
Preserve unused imported values in the JavaScript output that would otherwise be removed.Source:
src/compiler/commandLineParser.ts:1642-1649Editor Support
Options for editor integration.plugins
Specify a list of language service plugins to include.Source:
src/compiler/commandLineParser.ts:1660-1669disableSizeLimit
Remove the 20mb cap on total source code size for JavaScript files in the TypeScript language server.Source:
src/compiler/commandLineParser.ts:1479-1485Output Formatting
Options that affect how output is displayed.pretty
Enable color and formatting in TypeScript’s output to make compiler errors easier to read.Source:
src/compiler/commandLineParser.ts:422-428preserveWatchOutput
Disable wiping the console in watch mode.Source:
src/compiler/commandLineParser.ts:393-399Watch and Build Modes
Options specific to watch mode and build mode.assumeChangesOnlyAffectDirectDependencies
Have recompiles in projects that use
incremental and watch mode assume that changes within a file will only affect files directly depending on it.Source: src/compiler/commandLineParser.ts:548-556Compiler Diagnostics
Options for debugging the compiler.listFiles
Print all of the files read during the compilation.Source:
src/compiler/commandLineParser.ts:401-406explainFiles
Print files read during the compilation including why it was included.Source:
src/compiler/commandLineParser.ts:408-413listEmittedFiles
Print the names of emitted files after a compilation.Source:
src/compiler/commandLineParser.ts:415-420traceResolution
Log paths used during the
moduleResolution process.Source: src/compiler/commandLineParser.ts:430-435diagnostics
Output compiler performance information after building.Source:
src/compiler/commandLineParser.ts:437-442extendedDiagnostics
Output more detailed compiler performance information after building.Source:
src/compiler/commandLineParser.ts:444-449generateCpuProfile
Emit a v8 CPU profile of the compiler run for debugging.Source:
src/compiler/commandLineParser.ts:451-458generateTrace
Generates an event trace and a list of types.Source:
src/compiler/commandLineParser.ts:460-466noCheck
Disable full type checking (only critical parse and emit errors will be reported).Source:
src/compiler/commandLineParser.ts:529-537Default Compiler Options
When you runtsc --init, TypeScript creates a tsconfig.json with these default options:
src/compiler/commandLineParser.ts:1858-1865
Common Configuration Patterns
Strict Mode (Recommended)
Modern Node.js
Library Development
Monorepo with Project References
Related Documentation
tsconfig.json
Learn about the complete tsconfig.json structure
Project References
Structure large TypeScript projects efficiently