Optional
Readonly
allowSuppress arbitrary extension import errors with the assumption that a bundler will be handling it.
Optional
Readonly
allowAllows TypeScript files to import each other with TypeScript-specific extensions (.ts
, .mts
, .tsx
). Requires noEmit
or emitDeclarationOnly
.
Optional
Readonly
allowAllow JavaScript files to be compiled.
Optional
Readonly
allowAllow default imports from modules with no default export. This does not affect code emit, just typechecking.
Optional
Readonly
allowAllow Unreachable Code. When:
undefined
(default) provide suggestions as warnings to editorstrue
unreachable code is ignoredfalse
raises compiler errors about unreachable codeThese warnings are only about code which is provably unreachable due to the use of JavaScript syntax.
Optional
Readonly
allowAllow Unused Labels. When:
undefined
(default) provide suggestions as warnings to editorstrue
unused labels are ignoredfalse
raises compiler errors about unused labelsLabels are very rare in JavaScript and typically indicate an attempt to write an object literal:
function verifyAge(age: number) {
// Forgot 'return' statement
if (age > 18) {
verified: true;
// ^^^^^^^^ Unused label.
}
}
Optional
Readonly
alwaysEnsures that your files are parsed in the ECMAScript strict mode, and emit “use strict” for each source file.
Optional
Readonly
baseLets you set a base directory to resolve non-absolute module names. You can define a root folder where you can do absolute file resolution.
Optional
Readonly
checkCheck JS. Works in tandem with allowJs. When checkJs is enabled then errors are reported in JavaScript files. This is the equivalent of including //
Optional
Readonly
customList of additional conditions that should succeed when TypeScript resolves from an exports
or imports
field of a package.json
.
Optional
Readonly
declarationTo be specified along with the above.
Optional
Readonly
declarationOffers a way to configure the root directory for where declaration files are emitted.
Optional
Readonly
declarationGenerates a source map for .d.ts files which map back to the original .ts source file. This will allow editors such as VS Code to go to the original .ts file when using features like Go to Definition.
Optional
Readonly
downlevelDownleveling is TypeScript’s term for transpiling to an older version of JavaScript. This flag is to enable support for a more accurate implementation of how modern JavaScript iterates through new concepts in older JavaScript runtimes.
ECMAScript 6 added several new iteration primitives: the for / of loop (for (el of arr)), Array spread ([a, ...b]), argument spread (fn(...args)), and Symbol.iterator. downlevelIteration allows for these iteration primitives to be used more accurately in ES5 environments if a Symbol.iterator implementation is present.
Optional
Readonly
emitOnly emit .d.ts files; do not emit .js files.
Optional
Readonly
emitEnables experimental support for decorators, which is in stage 2 of the TC39 standardization process. Decorators are a language feature which hasn’t yet been fully ratified into the JavaScript specification. This means that the implementation version in TypeScript may differ from the implementation in JavaScript when it it decided by TC39. You can find out more about decorator support in TypeScript in the handbook.
Optional
Readonly
esEmit __importStar and __importDefault helpers for runtime babel ecosystem compatibility and enable --allowSyntheticDefaultImports for typesystem compatibility.
Optional
Readonly
exactSpecifies that optional property types should be interpreted exactly as written, meaning that | undefined
is not added to the type Available with TypeScript 4.4 and newer.
Optional
Readonly
experimentalEnables experimental support for decorators, which is in stage 2 of the TC39 standardization process.
Optional
Readonly
forceDisallow inconsistently-cased references to the same file.
Optional
Readonly
importsThis flag works because you can use import type
to explicitly create an import
statement which should never be emitted into JavaScript.
Optional
Readonly
incrementalTells TypeScript to save information about the project graph from the last compilation to files stored on disk. This creates a series of .tsbuildinfo files in the same folder as your compilation output. They are not used by your JavaScript at runtime and can be safely deleted. You can read more about the flag in the 3.4 release notes.
Optional
Readonly
inlineWhen set, instead of writing out a .js.map file to provide source maps, TypeScript will embed the source map content in the .js files.
Optional
Readonly
inlineWhen set, TypeScript will include the original content of the .ts file as an embedded string in the source map. This is often useful in the same cases as inlineSourceMap.
Optional
Readonly
isolatedPerform additional checks to ensure that separate compilation (such as with transpileModule or.
Optional
Readonly
jsxSupport JSX in .tsx files: "react", "preserve", "react-native" etc.
Optional
Readonly
jsxDeclares the module specifier to be used for importing the jsx and jsxs factory functions when using jsx.
Optional
Readonly
libReference for type definitions / libraries to use (eg. ES2016, ES5, ES2018).
Optional
Readonly
moduleSets the module system for the program. See https://www.typescriptlang.org/docs/handbook/modules.html#ambient-modules.
Optional
Readonly
moduleThis setting controls how TypeScript determines whether a file is a script or a module.
Optional
Readonly
moduleDetermine how modules get resolved. Either "Node" for Node.js/io.js style resolution, or "Classic".
Optional
Readonly
noDo not emit outputs.
Optional
Readonly
noDo not emit compiler output files like JavaScript source code, source-maps or declarations if any errors were reported.
Optional
Readonly
noReport errors for fallthrough cases in switch statements. Ensures that any non-empty case inside a switch statement includes either break or return. This means you won’t accidentally ship a case fallthrough bug.
Optional
Readonly
noIn some cases where no type annotations are present, TypeScript will fall back to a type of any for a variable when it cannot infer the type.
Optional
Readonly
noUsing noImplicitOverride
, you can ensure that sub-classes never go out of sync as they are required to explicitly declare that they are overriding a member using the override
keyword.
This also improves readability of the programmer's intent.
Available with TypeScript 4.3 and newer.
Optional
Readonly
noWhen enabled, TypeScript will check all code paths in a function to ensure they return a value.
Optional
Readonly
noRaise error on ‘this’ expressions with an implied ‘any’ type.
Optional
Readonly
noRaise error on use of the dot syntax to access fields which are not defined.
Optional
Readonly
noRaise error when accessing indexes on objects with unknown keys defined in index signatures.
Optional
Readonly
noReport errors on unused local variables.
Optional
Readonly
noReport errors on unused parameters in functions.
Optional
Readonly
outOutput directory for the compiled files.
Optional
Readonly
pathsA series of entries which re-map imports to lookup locations relative to the baseUrl, there is a larger coverage of paths in the handbook. paths lets you declare how TypeScript should resolve an import in your require/imports.
Optional
Readonly
resolveAllows importing modules with a ‘.json’ extension, which is a common practice in node projects. This includes generating a type for the import based on the static JSON shape.
Optional
Readonly
resolveForces TypeScript to consult the exports
field of package.json
files if it ever reads from a package in node_modules
.
Optional
Readonly
resolveForces TypeScript to consult the imports
field of package.json
when performing a lookup that begins with #
from a file that has a package.json
as an ancestor.
Optional
Readonly
rootSpecifies the root directory of input files.
Only use to control the output directory structure with outDir
.
Optional
Readonly
skipSkip type checking of all declaration files (*.d.ts).
Optional
Readonly
sourceEnables the generation of sourcemap files.
Optional
Readonly
sourceSpecify the location where a debugger should locate TypeScript files instead of relative source locations.
Optional
Readonly
strictThe strict flag enables a wide range of type checking behavior that results in stronger guarantees of program correctness. Turning this on is equivalent to enabling all of the strict mode family options, which are outlined below. You can then turn off individual strict mode family checks as needed.
Optional
Readonly
strictWhen strictNullChecks is false, null and undefined are effectively ignored by the language. This can lead to unexpected errors at runtime. When strictNullChecks is true, null and undefined have their own distinct types and you’ll get a type error if you try to use them where a concrete value is expected.
Optional
Readonly
strictWhen set to true, TypeScript will raise an error when a class property was declared but not set in the constructor.
Optional
Readonly
stripDo not emit declarations for code that has an @internal
annotation in it’s JSDoc comment.
Optional
Readonly
targetModern browsers support all ES6 features, so ES6 is a good choice. You might choose to set a lower target if your code is deployed to older environments, or a higher target if your code is guaranteed to run in newer environments.
Optional
Readonly
tsThis setting lets you specify a file for storing incremental compilation information as a part of composite projects which enables faster building of larger TypeScript codebases. You can read more about composite projects in the handbook.
Optional
Readonly
typeIf typeRoots is specified, only packages under typeRoots will be included.
Optional
Readonly
typesTypes to include in compilation.
Optional
Readonly
useChange the type of the variable in a catch clause from any to unknown Available with TypeScript 4.4 and newer.
Optional
Readonly
verbatimSimplifies TypeScript's handling of import/export type
modifiers.
TypeScriptCompilerOptions