Skip to content

Instantly share code, notes, and snippets.

@orta
Last active August 24, 2020 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orta/264947f311321a9cd122fa3f74b78a1e to your computer and use it in GitHub Desktop.
Save orta/264947f311321a9cd122fa3f74b78a1e to your computer and use it in GitHub Desktop.
TSConfig one-liners
Name Site Schema
compilerOptions The set of compiler options for your project Instructs the TypeScript compiler how to compile .ts files
allowJs Let TS include .JS files in imports Allow javascript files to be compiled.
allowSyntheticDefaultImports Allow 'import x from y' when a module doesn't have a default export Allow default imports from modules with no default export. This does not affect code emit, just typechecking.
allowUmdGlobalAccess Assume UMD imports are all globally available Allow accessing UMD globals from modules.
allowUnreachableCode Error when code will never be called Do not report errors on unreachable code.
allowUnusedLabels Error when accidentally creating a label Do not report errors on unused labels.
alwaysStrict Ensure 'use strict' is always emitted Parse in strict mode and emit 'use strict' for each source file. Requires TypeScript version 2.1 or later.
assumeChangesOnlyAffectDirectDependencies A drastically faster, but occasionally inaccurate watch mode option. Have recompiles in '--incremental' and '--watch' assume that changes within a file will only affect files directly depending on it.
baseUrl Set a baseurl for relative module names Base directory to resolve non-relative module names.
charset Manually set the text encoding for reading files The character set of the input files.
checkJs Run the type checker on .js files in your project Report errors in .js files. Requires TypeScript version 2.3 or later.
composite Used to create multiple build projects Enables building for project references.
declaration Emit d.ts files for referenced files in the project Generates corresponding d.ts files.
declarationDir Set the root directory for d.ts files to go Specify output directory for generated declaration files. Requires TypeScript version 2.0 or later.
declarationMap Create sourcemaps for d.ts files Generates a sourcemap for each corresponding '.d.ts' file. Requires TypeScript version 2.9 or later.
diagnostics Output additional information after a compile Show diagnostic information.
disableReferencedProjectLoad Reduces the number of projects loaded automatically by TypeScript N/A
disableSizeLimit Remove the memory cap on the TypeScript language server Disable size limit for JavaScript project. Requires TypeScript version 2.0 or later.
disableSolutionSearching Opt a project out of multi-project reference checking Disable solution searching for this project.
disableSourceOfProjectReferenceRedirect Use d.ts files as the source of truth for tooling between composite project boundries Disable use of source files instead of declaration files from referenced projects.
downlevelIteration Emit more compliant, but verbose JavaScript for iterating objects Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. Requires TypeScript version 2.3 or later.
emitBOM Include a byte order mark to output files Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.
emitDeclarationOnly Only output d.ts files and not .js files Only emit '.d.ts' declaration files.
emitDecoratorMetadata Adds additional type metadata to decorators in emitted code Emit design-type metadata for decorated declarations in source.
esModuleInterop Emit additional JS to ease support for importing commonjs modules Emit '__importStar' and '__importDefault' helpers for runtime babel ecosystem compatibility and enable '--allowSyntheticDefaultImports' for typesystem compatibility. Requires TypeScript version 2.7 or later.
exclude Files or patterns to be skipped from the include option Specifies a list of files to be excluded from compilation. The 'exclude' property only affects the files included via the 'include' property and not the 'files' property. Glob patterns require TypeScript version 2.0 or later.
experimentalDecorators Enable experimental support for TC39 stage 2 decorators Enables experimental support for ES7 decorators.
extendedDiagnostics Include a lot of diagnostic information after a compile Show verbose diagnostic information.
extends Inherit options for a TSConfig Path to base configuration file to inherit from. Requires TypeScript version 2.1 or later
fallbackPolling What the watcher should use if the system runs out of native file watchers N/A
files Include a set list of files, does not support globs If no 'files' or 'include' property is present in a tsconfig.json, the compiler defaults to including all files in the containing directory and subdirectories except those specified by 'exclude'. When a 'files' property is specified, only those files and those specified by 'include' are included.
forceConsistentCasingInFileNames Ensure that casing is correct in imports Disallow inconsistently-cased references to the same file.
generateCpuProfile Emit a v8 CPU profile of the compiler run for debugging N/A
importHelpers Allow importing helper functions once per project, instead of including them per-file Import emit helpers (e.g. '__extends', '__rest', etc..) from tslib. Requires TypeScript version 2.1 or later.
importsNotUsedAsValues Controls which syntax you use for importing types Specify emit/checking behavior for imports that are only used for types
include Files or patterns to include in this project Specifies a list of glob patterns that match files to be included in compilation. If no 'files' or 'include' property is present in a tsconfig.json, the compiler defaults to including all files in the containing directory and subdirectories except those specified by 'exclude'. Requires TypeScript version 2.0 or later
incremental Save .tsbuildinfo files to allow for incremental compilation of projects Enable incremental compilation.
inlineSourceMap Include sourcemap files inside the emitted JavaScript Emit a single file with source maps instead of having a separate file.
inlineSources Include sourcemap files inside the emitted JavaScript Emit the source alongside the sourcemaps within a single file; requires --inlineSourceMap to be set.
isolatedModules Ensure that each file can be safely transpiled without relying on other imports Unconditionally emit imports for unresolved files.
jsx Control how JSX is emitted Specify JSX code generation: 'preserve', 'react', or 'react-native'.
jsxFactory Control the function emitted by JSX Specify the JSX factory function to use when targeting react JSX emit, e.g. 'React.createElement' or 'h'. Requires TypeScript version 2.1 or later.
jsxFragmentFactory Specifies what identifiers a JSX fragment should be transformed to Specify the JSX Fragment reference to use for fragements when targeting react JSX emit, e.g. 'React.Fragment' or 'Fragment'. Requires TypeScript version 4.0 or later.
keyofStringsOnly Make keyof only return strings instead of string or numbers Resolve 'keyof' to string valued property names only (no numbers or symbols). Requires TypeScript version 2.9 or later.
lib Include type definitions you know are available in your JavaScript runtime List of library files to be included in the compilation. Possible values are: 'ES5', 'ES6', 'ES2015', 'ES7', 'ES2016', 'ES2017', 'ES2018', 'ESNext', 'DOM', 'DOM.Iterable', 'WebWorker', 'ScriptHost', 'ES2015.Core', 'ES2015.Collection', 'ES2015.Generator', 'ES2015.Iterable', 'ES2015.Promise', 'ES2015.Proxy', 'ES2015.Reflect', 'ES2015.Symbol', 'ES2015.Symbol.WellKnown', 'ES2016.Array.Include', 'ES2017.object', 'ES2017.Intl', 'ES2017.SharedMemory', 'ES2017.String', 'ES2017.TypedArrays', 'ES2018.Intl', 'ES2018.Promise', 'ES2018.RegExp', 'ESNext.AsyncIterable', 'ESNext.Array', 'ESNext.Intl', 'ESNext.Symbol'. Requires TypeScript version 2.0 or later.
listEmittedFiles Print the names of emitted files after a compile Enable to list all emitted files. Requires TypeScript version 2.0 or later.
listFiles Print all of the files read during the compilation Print names of files part of the compilation.
locale Set the language of the tsc output N/A
mapRoot Set an external root for sourcemaps Specifies the location where debugger should locate map files instead of generated locations
maxNodeModuleJsDepth How deep should TypeScript run type checking in node_modules The maximum dependency depth to search under node_modules and load JavaScript files. Only applicable with --allowJs.
module Sets the expected module system for your runtime Specify module code generation: 'None', 'CommonJS', 'AMD', 'System', 'UMD', 'ES6', 'ES2015', 'ES2020' or 'ESNext'. Only 'AMD' and 'System' can be used in conjunction with --outFile.
moduleResolution Allow TypeScript 1.6 module resolution strategies Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6) .
newLine Set the newline character Specifies the end of line sequence to be used when emitting files: 'crlf' (Windows) or 'lf' (Unix).
noEmit Do not emit files from a compilation Do not emit output.
noEmitHelpers Assume helpers are available in the global runtime Do not generate custom helper functions like __extends in compiled output.
noEmitOnError Only emit files on a successful compile Do not emit outputs if any type checking errors were reported.
noErrorTruncation Do not truncate error messages Do not truncate error messages.
noFallthroughCasesInSwitch Report errors for fallthrough cases in switch statements. Report errors for fallthrough cases in switch statement.
noImplicitAny Avoid introducing anys inside your codebase when a type could be specified Warn on expressions and declarations with an implied 'any' type.
noImplicitReturns Ensure that all codepaths return in a function Report error when not all code paths in function return a value.
noImplicitThis Raise errors when 'this' would be any Raise error on 'this' expressions with an implied any type.
noImplicitUseStrict Disable 'use strict' in the JS emit Do not emit 'use strict' directives in module output.
noLib Ignore options from lib Do not include the default library file (lib.d.ts).
noResolve Skip ahead-of-time checking for import and <reference files Do not add triple-slash references or module import targets to the list of compiled files.
noStrictGenericChecks Disable strict checking of generic signatures in functions. Disable strict checking of generic signatures in function types.
noUnusedLocals Error when a local variable isn't read Report errors on unused locals. Requires TypeScript version 2.0 or later.
noUnusedParameters Error when a parameter isn't used Report errors on unused parameters. Requires TypeScript version 2.0 or later.
out Do not use this N/A
outDir Set an output folder for all emitted files Redirect output structure to the directory.
outFile Output a single file of all JS files concatenated Concatenate and emit output to single file.
paths A set of locations to look for imports in Specify path mapping to be computed relative to baseUrl option.
plugins A list of language service plugins to include List of TypeScript language server plugins to load. Requires TypeScript version 2.3 or later.
preserveConstEnums Do not erase `const enum` declarations in generated code Do not erase const enum declarations in generated code.
preserveSymlinks Do not resolve symlink paths Do not resolve symlinks to their real path; treat a symlinked file like a real one.
preserveWatchOutput Do not wipe the console in watch mode Keep outdated console output in watch mode instead of clearing the screen.
pretty Use color and formatting to make compiler errors easier to read Stylize errors and messages using color and context (experimental).
reactNamespace Specify the object which 'createElement' is called on in JSX Specifies the object invoked for createElement and __spread when targeting 'react' JSX emit.
references Provide a structure for composite projects Referenced projects. Requires TypeScript version 3.0 or later
removeComments Remove comments in TypeScript from appearing in JavaScript Do not emit comments to output.
resolveJsonModule Allow importing .json files Include modules imported with '.json' extension. Requires TypeScript version 2.9 or later.
rootDir Sets the root folder within your source files Specifies the root directory of input files. Use to control the output directory structure with --outDir.
rootDirs Set multiple root directories Specify list of root directories to be used when resolving modules.
skipDefaultLibCheck use SkipLibCheck instead undefined
skipLibCheck Skip type checking of declaration files Skip type checking of declaration files. Requires TypeScript version 2.0 or later.
sourceMap Creates source map files for emitted JavaScript files Generates corresponding '.map' file.
sourceRoot Sets the root path for debuggers to find the reference source code Specifies the location where debugger should locate TypeScript files instead of source locations.
strict Enable TypeScript's most in-depth type checking rules Enable all strict type checking options. Requires TypeScript version 2.3 or later.
strictBindCallApply Ensure that 'call', 'bind' and 'apply' have the right arguments Enable stricter checking of of the `bind`, `call`, and `apply` methods on functions.
strictFunctionTypes Ensure that function parameters are consistent Disable bivariant parameter checking for function types. Requires TypeScript version 2.6 or later.
strictNullChecks Ensure that nullability is respected in the type checker Enable strict null checks. Requires TypeScript version 2.0 or later.
strictPropertyInitialization Ensure that all class properties match their types after the constructor has finished Ensure non-undefined class properties are initialized in the constructor. Requires TypeScript version 2.7 or later.
stripInternal Remove declarations which have '@internal' in their JSDoc comments Do not emit declarations for code that has an '@internal' annotation.
suppressExcessPropertyErrors Allow additional properties being set during creation of types Suppress excess property checks for object literals.
suppressImplicitAnyIndexErrors Remove the warning when using string indexes to access unknown properties Suppress noImplicitAny errors for indexing objects lacking index signatures.
target Set the supported JavaScript language runtime to transpile to Specify ECMAScript target version: 'ES3', 'ES5', 'ES6'/'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ESNext'
traceResolution Log out paths when resolving all modules Enable tracing of the name resolution process.
tsBuildInfoFile Set the folder for .tsbuildinfo files Specify file to store incremental compilation information.
typeAcquisition Sets of options for Automatic Type Acquisition in JavaScript uto type (.d.ts) acquisition options for this project. Requires TypeScript version 2.1 or later.
typeRoots locations where TypeScript should look for type definitions Specify list of directories for type definition files to be included. Requires TypeScript version 2.0 or later.
types Used to create an allowlist of types to be included in the compile Type declaration files to be included in compilation. Requires TypeScript version 2.0 or later.
useDefineForClassFields Use define characteristics for handling class fields Emit ECMAScript standard class fields. Requires TypeScript version 3.7 or later.
watchDirectory Determine how directories are watched N/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment