Concurrent visitors over the last 30 minutes. (~)
Peak concurrent visitors -
Yesterday: 0 / Today:
0
The tsconfig.json file specifies how the TypeScript compiler converts your project to JS.
1234567{ "files": ["node_modules/my-library/index.ts"], "exclude": ["node_modules", "dist"], "include": ["src/**/*"], "extends": "config/base.json", "compilerOptions": {} }
| Option | Priority | Description |
|---|---|---|
| files | 1 | List of individual files to compile (extensions required!) |
| exclude | 2 | List of file paths to exclude from compilation |
| include | 3 | List of file paths to compile You can omit the .ts, .tsx, and .d.ts extensions, and .js and .jsx are added when allowJS: true |
| extends | - | Another TS configuration to inherit from |
| compilerOptions | - | Specifies compiler options |
Here are the main options you can use in CompilerOptions.
1234567891011{ "compilerOptions": { "target": "ES2015", "module": "ESNext", "moduleResolution": "Node", "jsx": "preserve", "strict": true, "esModuleInterop": true, "lib": ["ESNext", "DOM"] } }
| Option | Default | Description |
|---|---|---|
| target | "ES3" |
Specifies the ES version to compile to. |
| lib | - | Specifies the libraries to use in compilation. |
| module | "CommonJS" |
Specifies the module system. |
| moduleResolution | "Node" |
Specifies the module resolution strategy."NodeNext" supports the exports field and conditional resolution."bundler" is a resolution strategy tailored to bundlers such as Vite and Webpack. |
| esModuleInterop | false |
Enables ESM module compatibility. |
| isolatedModules | false |
Compiles every file as a module, and raises an error if a file has no import or export. |
| moduleDetection | - | Specifies how modules are detected."force" treats every file as a module to prevent global scope conflicts. |
| allowSyntheticDefaultImports | true |
Allows default imports from modules that have no default export (export default). |
| allowImportingTsExtensions | false |
Lets you use files with the .ts and .tsx extensions directly in import statements. |
| baseUrl | - | Specifies the base path used for module resolution. |
| paths | - | Specifies path aliases used for module resolution. |
| types | - | Specifies the list of @types packages the compiler references; packages not listed are ignored. |
| typeRoots | ["./node_modules/@types"] |
Specifies the list of paths to type declarations (.d.ts) the compiler references; paths not listed are ignored. |
| allowJS | false |
Allows compiling JS files. |
| checkJs | false |
Whether to report errors in .js files.Only takes effect when allowJS is true. |
| jsx | "preserve" |
Specifies how JSX is compiled."react-jsx" compiles with the new JSX Transform of React 17+. |
| declaration | true |
Whether to generate declaration files (*.d.ts) that contain the type information of all TS (JS) files. |
| declarationMap | false |
Whether to generate source map files (.d.ts.map) along with the .d.ts files.Useful for jumping to the source code while debugging. |
| sourceMap | false |
Whether to generate source map files. Lets debugging tools and the like show the original TS file of a JS file. |
| noEmit | false |
Doesn't generate output files (.js, .d.ts, and so on) after compilation.Use it when you only want to run type checks. |
| skipLibCheck | false |
Skips type checking of .d.ts files.Ignores errors in third-party libraries and speeds up builds. |
| strict | false |
Enables stricter type checking. Includes all strict options ( noImplicitAny, strictNullChecks, and so on). |
| noImplicitAny | false |
(strict) Enables checks for implicit any types. |
| noImplicitThis | false |
(strict) Enables checks for implicit this types. |
| strictNullChecks | false |
(strict) Enables strict null and undefined type checks. |
| strictFunctionTypes | false |
(strict) Enables strict type checks for function parameters. |
| strictPropertyInitialization | false |
(strict) Enables strict checks for class property initialization. |
| strictBindCallApply | false |
(strict) Enables strict argument checks for the bind, call, and apply methods. |
| noUnusedLocals | false |
Raises an error when there are unused local variables. |
| noUnusedParameters | false |
Raises an error when there are unused function parameters. |
| noFallthroughCasesInSwitch | false |
Forbids fall-through, where a case block of a switch statement falls into the next case, to prevent logic errors. |
| noUncheckedIndexedAccess | false |
Includes the possibility of undefined in the type when you access an object by index. |
| noUncheckedSideEffectImports | false |
Raises an error when an import that triggers a module's side effects isn't checked.Strengthens type safety (TypeScript 5.0+). |
| useDefineForClassFields | false |
Follows the ECMAScript standard (defineProperty) behavior when declaring class fields.The default is true with target: "ES2022" or higher. |
| resolveJsonModule | false |
Allows importing .json files as modules. |
| tsBuildInfoFile | .tsbuildinfo |
Specifies the path of the .tsbuildinfo file for incremental compilation (recompiling only what changed since the previous compilation). |
| verbatimModuleSyntax | false |
Interprets ES module (ECMAScript Modules) syntax more strictly and accurately |