Skip to main content
TypeScript compiler options control how the TypeScript compiler processes your code. These options can be specified on the command line with tsc or in a tsconfig.json file.

Language and Environment

target

target
string
default:"ES3"
Set the JavaScript language version for emitted JavaScript and include compatible library declarations.Valid values: ES3, ES5, ES6/ES2015, ES2016, ES2017, ES2018, ES2019, ES2020, ES2021, ES2022, ES2023, ES2024, ES2025, ESNextCommand line:
tsconfig.json:

lib

lib
string[]
Specify a set of bundled library declaration files that describe the target runtime environment.Common values: ES5, ES2015, ES2016, ES2017, ES2018, ES2019, ES2020, ES2021, ES2022, ES2023, ES2024, ES2025, ESNext, DOM, DOM.Iterable, WebWorker, ScriptHostCommand line:
tsconfig.json:

jsx

jsx
string
Specify what JSX code is generated.Valid values:
  • preserve - Keep JSX syntax as-is
  • react - Emit React.createElement calls
  • react-jsx - Emit _jsx calls (React 17+)
  • react-jsxdev - Emit _jsxDEV calls (development)
  • react-native - Keep JSX but emit .js files
Command line:
tsconfig.json:

experimentalDecorators

experimentalDecorators
boolean
default:"false"
Enable experimental support for legacy experimental decorators.Command line:
tsconfig.json:

emitDecoratorMetadata

emitDecoratorMetadata
boolean
default:"false"
Emit design-type metadata for decorated declarations in source files.Command line:
tsconfig.json:

jsxFactory

jsxFactory
string
default:"React.createElement"
Specify the JSX factory function used when targeting React JSX emit.Command line:
tsconfig.json:

jsxFragmentFactory

jsxFragmentFactory
string
default:"React.Fragment"
Specify the JSX Fragment reference used for fragments when targeting React JSX emit.tsconfig.json:

jsxImportSource

jsxImportSource
string
default:"react"
Specify module specifier used to import the JSX factory functions when using jsx: react-jsx.tsconfig.json:

noLib

noLib
boolean
default:"false"
Disable including any library files including the default lib.d.ts.Command line:

useDefineForClassFields

useDefineForClassFields
boolean
default:"true for ES2022+"
Emit ECMAScript-standard-compliant class fields.tsconfig.json:

moduleDetection

moduleDetection
string
default:"auto"
Control what method is used to detect module-format JS files.Valid values:
  • auto - Treat files with imports/exports as modules
  • legacy - Only .mts/.cts are modules
  • force - All files are modules
tsconfig.json:

Modules

module

module
string
default:"CommonJS"
Specify what module code is generated.Valid values: CommonJS, AMD, UMD, System, ES6/ES2015, ES2020, ES2022, ESNext, Node16, Node18, Node20, NodeNext, Preserve, NoneCommand line:
tsconfig.json:

moduleResolution

moduleResolution
string
default:"node10"
Specify how TypeScript looks up a file from a given module specifier.Valid values:
  • node10 / node - Classic Node.js resolution
  • node16 - Node.js 16+ with package exports
  • nodenext - Latest Node.js resolution
  • bundler - Bundler-style resolution
  • classic - TypeScript pre-1.6 (deprecated)
Command line:
tsconfig.json:

baseUrl

baseUrl
string
Specify the base directory to resolve non-relative module names.Command line:
tsconfig.json:

paths

paths
object
Specify a set of entries that re-map imports to additional lookup locations.tsconfig.json only:

rootDirs

rootDirs
string[]
Allow multiple folders to be treated as one when resolving modules.tsconfig.json only:

typeRoots

typeRoots
string[]
Specify multiple folders that act like ./node_modules/@types.Command line:
tsconfig.json:

types

types
string[]
Specify type package names to be included without being referenced in a source file.Command line:
tsconfig.json:

resolveJsonModule

resolveJsonModule
boolean
default:"false"
Enable importing .json files.Command line:
tsconfig.json:
Example:

noResolve

noResolve
boolean
default:"false"
Disallow imports, requires, or references from expanding the number of files TypeScript should add to a project.Command line:

moduleSuffixes

moduleSuffixes
string[]
List of file name suffixes to search when resolving a module.tsconfig.json:

allowImportingTsExtensions

allowImportingTsExtensions
boolean
default:"false"
Allow imports to include TypeScript file extensions. Requires —moduleResolution bundler and either —noEmit or —emitDeclarationOnly.tsconfig.json:

rewriteRelativeImportExtensions

rewriteRelativeImportExtensions
boolean
default:"false"
Rewrite .ts, .tsx, .mts, and .cts file extensions in relative import paths to their JavaScript equivalent in output files.tsconfig.json:

resolvePackageJsonExports

resolvePackageJsonExports
boolean
default:"true for node16/nodenext/bundler"
Use the package.json ‘exports’ field when resolving package imports.tsconfig.json:

resolvePackageJsonImports

resolvePackageJsonImports
boolean
default:"true for node16/nodenext/bundler"
Use the package.json ‘imports’ field when resolving imports.tsconfig.json:

customConditions

customConditions
string[]
Conditions to set in addition to the resolver-specific defaults when resolving imports.tsconfig.json:

noUncheckedSideEffectImports

noUncheckedSideEffectImports
boolean
default:"true"
Check side effect imports.tsconfig.json:

Emit

declaration

declaration
boolean
default:"false"
Generate .d.ts files from TypeScript and JavaScript files in your project.Command line:
tsconfig.json:

declarationMap

declarationMap
boolean
default:"false"
Create sourcemaps for d.ts files.Command line:
tsconfig.json:

emitDeclarationOnly

emitDeclarationOnly
boolean
default:"false"
Only output d.ts files and not JavaScript files.Command line:
tsconfig.json:

sourceMap

sourceMap
boolean
default:"false"
Create source map files for emitted JavaScript files.Command line:
tsconfig.json:

inlineSourceMap

inlineSourceMap
boolean
default:"false"
Include sourcemap files inside the emitted JavaScript.Command line:
tsconfig.json:

outFile

outFile
string
Specify a file that bundles all outputs into one JavaScript file.Command line:
tsconfig.json:

outDir

outDir
string
Specify an output folder for all emitted files.Command line:
tsconfig.json:

removeComments

removeComments
boolean
default:"false"
Disable emitting comments.Command line:
tsconfig.json:

noEmit

noEmit
boolean
default:"false"
Disable emitting files from a compilation.Command line:
tsconfig.json:

importHelpers

importHelpers
boolean
default:"false"
Allow importing helper functions from tslib once per project, instead of including them per-file.Command line:
tsconfig.json:

downlevelIteration

downlevelIteration
boolean
default:"false"
Emit more compliant, but verbose and less performant JavaScript for iteration.Command line:
tsconfig.json:

sourceRoot

sourceRoot
string
Specify the root path for debuggers to find the reference source code.Command line:
tsconfig.json:

mapRoot

mapRoot
string
Specify the location where debugger should locate map files instead of generated locations.tsconfig.json:

inlineSources

inlineSources
boolean
default:"false"
Include source code in the sourcemaps inside the emitted JavaScript.tsconfig.json:

emitBOM

emitBOM
boolean
default:"false"
Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.tsconfig.json:

newLine

newLine
string
default:"lf"
Set the newline character for emitting files.Valid values: crlf, lfCommand line:
tsconfig.json:

stripInternal

stripInternal
boolean
default:"false"
Disable emitting declarations that have @internal in their JSDoc comments.tsconfig.json:

noEmitHelpers

noEmitHelpers
boolean
default:"false"
Disable generating custom helper functions like __extends in compiled output.tsconfig.json:

noEmitOnError

noEmitOnError
boolean
default:"false"
Disable emitting files if any type checking errors are reported.Command line:
tsconfig.json:

preserveConstEnums

preserveConstEnums
boolean
default:"false"
Disable erasing const enum declarations in generated code.tsconfig.json:

declarationDir

declarationDir
string
Specify the output directory for generated declaration files.Command line:
tsconfig.json:

Type Checking

strict

strict
boolean
default:"true"
Enable all strict type-checking options.Enables:
  • noImplicitAny
  • strictNullChecks
  • strictFunctionTypes
  • strictBindCallApply
  • strictPropertyInitialization
  • noImplicitThis
  • useUnknownInCatchVariables
  • alwaysStrict
  • strictBuiltinIteratorReturn
Command line:
tsconfig.json:

noImplicitAny

noImplicitAny
boolean
default:"true if strict"
Enable error reporting for expressions and declarations with an implied ‘any’ type.Command line:
tsconfig.json:
Example error:

strictNullChecks

strictNullChecks
boolean
default:"true if strict"
When type checking, take into account null and undefined.Command line:
tsconfig.json:
Example error:

strictFunctionTypes

strictFunctionTypes
boolean
default:"true if strict"
When assigning functions, check to ensure parameters and the return values are subtype-compatible.tsconfig.json:

strictBindCallApply

strictBindCallApply
boolean
default:"true if strict"
Check that the arguments for bind, call, and apply methods match the original function.tsconfig.json:

strictPropertyInitialization

strictPropertyInitialization
boolean
default:"true if strict"
Check for class properties that are declared but not set in the constructor.tsconfig.json:
Example error:

noImplicitThis

noImplicitThis
boolean
default:"true if strict"
Enable error reporting when ‘this’ is given the type ‘any’.tsconfig.json:

useUnknownInCatchVariables

useUnknownInCatchVariables
boolean
default:"true if strict"
Default catch clause variables as ‘unknown’ instead of ‘any’.tsconfig.json:
Example:

alwaysStrict

alwaysStrict
boolean
default:"true"
Ensure ‘use strict’ is always emitted.Command line:
tsconfig.json:

strictBuiltinIteratorReturn

strictBuiltinIteratorReturn
boolean
default:"true if strict"
Built-in iterators are instantiated with a TReturn type of undefined instead of any.tsconfig.json:

noUnusedLocals

noUnusedLocals
boolean
default:"false"
Enable error reporting when local variables aren’t read.Command line:
tsconfig.json:

noUnusedParameters

noUnusedParameters
boolean
default:"false"
Raise an error when a function parameter isn’t read.Command line:
tsconfig.json:

exactOptionalPropertyTypes

exactOptionalPropertyTypes
boolean
default:"false"
Interpret optional property types as written, rather than adding undefined.tsconfig.json:

noImplicitReturns

noImplicitReturns
boolean
default:"false"
Enable error reporting for codepaths that do not explicitly return in a function.Command line:
tsconfig.json:

noFallthroughCasesInSwitch

noFallthroughCasesInSwitch
boolean
default:"false"
Enable error reporting for fallthrough cases in switch statements.Command line:
tsconfig.json:

noUncheckedIndexedAccess

noUncheckedIndexedAccess
boolean
default:"false"
Add undefined to a type when accessed using an index.tsconfig.json:
Example:

noImplicitOverride

noImplicitOverride
boolean
default:"false"
Ensure overriding members in derived classes are marked with an override modifier.tsconfig.json:

noPropertyAccessFromIndexSignature

noPropertyAccessFromIndexSignature
boolean
default:"false"
Enforces using indexed accessors for keys declared using an indexed type.tsconfig.json:

allowUnusedLabels

allowUnusedLabels
boolean
Disable error reporting for unused labels.tsconfig.json:

allowUnreachableCode

allowUnreachableCode
boolean
Disable error reporting for unreachable code.tsconfig.json:

Interop Constraints

isolatedModules

isolatedModules
boolean
default:"false"
Ensure that each file can be safely transpiled without relying on other imports.Command line:
tsconfig.json:

verbatimModuleSyntax

verbatimModuleSyntax
boolean
default:"false"
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.tsconfig.json:

isolatedDeclarations

isolatedDeclarations
boolean
default:"false"
Require sufficient annotation on exports so other tools can trivially generate declaration files.tsconfig.json:

allowSyntheticDefaultImports

allowSyntheticDefaultImports
boolean
default:"true"
Allow ‘import x from y’ when a module doesn’t have a default export.Command line:
tsconfig.json:

esModuleInterop

esModuleInterop
boolean
default:"true"
Emit additional JavaScript to ease support for importing CommonJS modules. This enables allowSyntheticDefaultImports for type compatibility.Command line:
tsconfig.json:
Disable resolving symlinks to their realpath. This correlates to the same flag in node.tsconfig.json:

forceConsistentCasingInFileNames

forceConsistentCasingInFileNames
boolean
default:"true"
Ensure that casing is correct in imports.Command line:
tsconfig.json:

allowUmdGlobalAccess

allowUmdGlobalAccess
boolean
default:"false"
Allow accessing UMD globals from modules.tsconfig.json:

JavaScript Support

allowJs

allowJs
boolean
default:"false"
Allow JavaScript files to be a part of your program. Use the checkJs option to get errors from these files.Command line:
tsconfig.json:

checkJs

checkJs
boolean
default:"false"
Enable error reporting in type-checked JavaScript files.Command line:
tsconfig.json:

maxNodeModuleJsDepth

maxNodeModuleJsDepth
number
default:"0"
Specify the maximum folder depth used for checking JavaScript files from node_modules. Only applicable with allowJs.tsconfig.json:

Projects

incremental

incremental
boolean
default:"false"
Save .tsbuildinfo files to allow for incremental compilation of projects.Command line:
tsconfig.json:

composite

composite
boolean
default:"false"
Enable constraints that allow a TypeScript project to be used with project references.tsconfig.json only:

tsBuildInfoFile

tsBuildInfoFile
string
default:".tsbuildinfo"
Specify the path to .tsbuildinfo incremental compilation file.tsconfig.json:

disableSourceOfProjectReferenceRedirect

disableSourceOfProjectReferenceRedirect
boolean
default:"false"
Disable preferring source files instead of declaration files when referencing composite projects.tsconfig.json only:

disableSolutionSearching

disableSolutionSearching
boolean
default:"false"
Opt a project out of multi-project reference checking when editing.tsconfig.json only:

disableReferencedProjectLoad

disableReferencedProjectLoad
boolean
default:"false"
Reduce the number of projects loaded automatically by TypeScript.tsconfig.json only:

Completeness

skipDefaultLibCheck

skipDefaultLibCheck
boolean
default:"false"
Skip type checking .d.ts files that are included with TypeScript.tsconfig.json:

skipLibCheck

skipLibCheck
boolean
default:"false"
Skip type checking all .d.ts files.Command line:
tsconfig.json:

Editor Support

disableSizeLimit

disableSizeLimit
boolean
default:"false"
Remove the 20mb cap on total source code size for JavaScript files in the TypeScript language server.tsconfig.json:

plugins

plugins
array
Specify a list of language service plugins to include.tsconfig.json only:

Watch and Build Modes

assumeChangesOnlyAffectDirectDependencies

assumeChangesOnlyAffectDirectDependencies
boolean
default:"false"
Have recompiles in projects that use incremental and watch mode assume that changes within a file will only affect files directly depending on it.tsconfig.json:

Real-World Configuration Examples

Strict Modern TypeScript

tsconfig.json

Node.js Project

tsconfig.json

React Project

tsconfig.json

Library Project

tsconfig.json

Source Code Reference

All compiler options are defined in:
This reference is extracted from the actual TypeScript compiler source code and reflects the current implementation.