Optional ReadonlyallowSuppress arbitrary extension import errors with the assumption that a bundler will be handling it.
Optional ReadonlyallowAllows TypeScript files to import each other with TypeScript-specific extensions (.ts, .mts, .tsx). Requires noEmit or emitDeclarationOnly.
Optional ReadonlyallowAllow JavaScript files to be compiled.
Optional ReadonlyallowAllow default imports from modules with no default export. This does not affect code emit, just typechecking.
Optional ReadonlyallowAllow 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 ReadonlyallowAllow 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 ReadonlyalwaysEnsures that your files are parsed in the ECMAScript strict mode, and emit “use strict” for each source file.
Optional ReadonlybaseLets 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 ReadonlycheckCheck JS. Works in tandem with allowJs. When checkJs is enabled then errors are reported in JavaScript files. This is the equivalent of including //
Optional ReadonlycustomList of additional conditions that should succeed when TypeScript resolves from an exports or imports field of a package.json.
Optional ReadonlydeclarationTo be specified along with the above.
Optional ReadonlydeclarationOffers a way to configure the root directory for where declaration files are emitted.
Optional ReadonlydeclarationGenerates 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 ReadonlydownlevelDownleveling 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 ReadonlyemitOnly emit .d.ts files; do not emit .js files.
Optional ReadonlyemitEnables 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 ReadonlyesEmit __importStar and __importDefault helpers for runtime babel ecosystem compatibility and enable --allowSyntheticDefaultImports for typesystem compatibility.
Optional ReadonlyexactSpecifies 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 ReadonlyexperimentalEnables experimental support for decorators, which is in stage 2 of the TC39 standardization process.
Optional ReadonlyforceDisallow inconsistently-cased references to the same file.
Optional ReadonlyimportsThis flag works because you can use import type to explicitly create an import statement which should never be emitted into JavaScript.
Optional ReadonlyincrementalTells 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 ReadonlyinlineWhen 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 ReadonlyinlineWhen 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 ReadonlyisolatedPerform additional checks to ensure that separate compilation (such as with transpileModule or.
Optional ReadonlyjsxSupport JSX in .tsx files: "react", "preserve", "react-native" etc.
Optional ReadonlyjsxDeclares the module specifier to be used for importing the jsx and jsxs factory functions when using jsx.
Optional ReadonlylibReference for type definitions / libraries to use (eg. ES2016, ES5, ES2018).
Optional ReadonlymoduleSets the module system for the program. See https://www.typescriptlang.org/docs/handbook/modules.html#ambient-modules.
Optional ReadonlymoduleThis setting controls how TypeScript determines whether a file is a script or a module.
Optional ReadonlymoduleDetermine how modules get resolved. Either "Node" for Node.js/io.js style resolution, or "Classic".
Optional ReadonlynoDo not emit outputs.
Optional ReadonlynoDo not emit compiler output files like JavaScript source code, source-maps or declarations if any errors were reported.
Optional ReadonlynoReport 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 ReadonlynoIn 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 ReadonlynoUsing 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 ReadonlynoWhen enabled, TypeScript will check all code paths in a function to ensure they return a value.
Optional ReadonlynoRaise error on ‘this’ expressions with an implied ‘any’ type.
Optional ReadonlynoRaise error on use of the dot syntax to access fields which are not defined.
Optional ReadonlynoRaise error when accessing indexes on objects with unknown keys defined in index signatures.
Optional ReadonlynoReport errors on unused local variables.
Optional ReadonlynoReport errors on unused parameters in functions.
Optional ReadonlyoutOutput directory for the compiled files.
Optional ReadonlypathsA 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 ReadonlyresolveAllows 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 ReadonlyresolveForces TypeScript to consult the exports field of package.json files if it ever reads from a package in node_modules.
Optional ReadonlyresolveForces 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 ReadonlyrootSpecifies the root directory of input files.
Only use to control the output directory structure with outDir.
Optional ReadonlyskipSkip type checking of all declaration files (*.d.ts).
Optional ReadonlysourceEnables the generation of sourcemap files.
Optional ReadonlysourceSpecify the location where a debugger should locate TypeScript files instead of relative source locations.
Optional ReadonlystrictThe 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 ReadonlystrictWhen 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 ReadonlystrictWhen set to true, TypeScript will raise an error when a class property was declared but not set in the constructor.
Optional ReadonlystripDo not emit declarations for code that has an @internal annotation in it’s JSDoc comment.
Optional ReadonlytargetModern 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 ReadonlytsThis 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 ReadonlytypeIf typeRoots is specified, only packages under typeRoots will be included.
Optional ReadonlytypesTypes to include in compilation.
Optional ReadonlyuseChange the type of the variable in a catch clause from any to unknown Available with TypeScript 4.4 and newer.
Optional ReadonlyverbatimSimplifies TypeScript's handling of import/export type modifiers.
TypeScriptCompilerOptions