tsconfig-json.d.ts 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872
  1. declare namespace TsConfigJson {
  2. namespace CompilerOptions {
  3. export type JSX =
  4. | 'preserve'
  5. | 'react'
  6. | 'react-native';
  7. export type Module =
  8. | 'CommonJS'
  9. | 'AMD'
  10. | 'System'
  11. | 'UMD'
  12. | 'ES6'
  13. | 'ES2015'
  14. | 'ESNext'
  15. | 'None'
  16. // Lowercase alternatives
  17. | 'commonjs'
  18. | 'amd'
  19. | 'system'
  20. | 'umd'
  21. | 'es6'
  22. | 'es2015'
  23. | 'esnext'
  24. | 'none';
  25. export type NewLine =
  26. | 'CRLF'
  27. | 'LF'
  28. // Lowercase alternatives
  29. | 'crlf'
  30. | 'lf';
  31. export type Target =
  32. | 'ES3'
  33. | 'ES5'
  34. | 'ES6'
  35. | 'ES2015'
  36. | 'ES2016'
  37. | 'ES2017'
  38. | 'ES2018'
  39. | 'ES2019'
  40. | 'ES2020'
  41. | 'ESNext'
  42. // Lowercase alternatives
  43. | 'es3'
  44. | 'es5'
  45. | 'es6'
  46. | 'es2015'
  47. | 'es2016'
  48. | 'es2017'
  49. | 'es2018'
  50. | 'es2019'
  51. | 'es2020'
  52. | 'esnext';
  53. export type Lib =
  54. | 'ES5'
  55. | 'ES6'
  56. | 'ES7'
  57. | 'ES2015'
  58. | 'ES2015.Collection'
  59. | 'ES2015.Core'
  60. | 'ES2015.Generator'
  61. | 'ES2015.Iterable'
  62. | 'ES2015.Promise'
  63. | 'ES2015.Proxy'
  64. | 'ES2015.Reflect'
  65. | 'ES2015.Symbol.WellKnown'
  66. | 'ES2015.Symbol'
  67. | 'ES2016'
  68. | 'ES2016.Array.Include'
  69. | 'ES2017'
  70. | 'ES2017.Intl'
  71. | 'ES2017.Object'
  72. | 'ES2017.SharedMemory'
  73. | 'ES2017.String'
  74. | 'ES2017.TypedArrays'
  75. | 'ES2018'
  76. | 'ES2018.AsyncIterable'
  77. | 'ES2018.Intl'
  78. | 'ES2018.Promise'
  79. | 'ES2018.Regexp'
  80. | 'ES2019'
  81. | 'ES2019.Array'
  82. | 'ES2019.Object'
  83. | 'ES2019.String'
  84. | 'ES2019.Symbol'
  85. | 'ES2020'
  86. | 'ES2020.String'
  87. | 'ES2020.Symbol.WellKnown'
  88. | 'ESNext'
  89. | 'ESNext.Array'
  90. | 'ESNext.AsyncIterable'
  91. | 'ESNext.BigInt'
  92. | 'ESNext.Intl'
  93. | 'ESNext.Symbol'
  94. | 'DOM'
  95. | 'DOM.Iterable'
  96. | 'ScriptHost'
  97. | 'WebWorker'
  98. | 'WebWorker.ImportScripts'
  99. // Lowercase alternatives
  100. | 'es5'
  101. | 'es6'
  102. | 'es7'
  103. | 'es2015'
  104. | 'es2015.collection'
  105. | 'es2015.core'
  106. | 'es2015.generator'
  107. | 'es2015.iterable'
  108. | 'es2015.promise'
  109. | 'es2015.proxy'
  110. | 'es2015.reflect'
  111. | 'es2015.symbol.wellknown'
  112. | 'es2015.symbol'
  113. | 'es2016'
  114. | 'es2016.array.include'
  115. | 'es2017'
  116. | 'es2017.intl'
  117. | 'es2017.object'
  118. | 'es2017.sharedmemory'
  119. | 'es2017.string'
  120. | 'es2017.typedarrays'
  121. | 'es2018'
  122. | 'es2018.asynciterable'
  123. | 'es2018.intl'
  124. | 'es2018.promise'
  125. | 'es2018.regexp'
  126. | 'es2019'
  127. | 'es2019.array'
  128. | 'es2019.object'
  129. | 'es2019.string'
  130. | 'es2019.symbol'
  131. | 'es2020'
  132. | 'es2020.string'
  133. | 'es2020.symbol.wellknown'
  134. | 'esnext'
  135. | 'esnext.array'
  136. | 'esnext.asynciterable'
  137. | 'esnext.bigint'
  138. | 'esnext.intl'
  139. | 'esnext.symbol'
  140. | 'dom'
  141. | 'dom.iterable'
  142. | 'scripthost'
  143. | 'webworker'
  144. | 'webworker.importscripts';
  145. export interface Plugin {
  146. [key: string]: unknown;
  147. /**
  148. Plugin name.
  149. */
  150. name?: string;
  151. }
  152. }
  153. export interface CompilerOptions {
  154. /**
  155. The character set of the input files.
  156. @default 'utf8'
  157. */
  158. charset?: string;
  159. /**
  160. Enables building for project references.
  161. @default true
  162. */
  163. composite?: boolean;
  164. /**
  165. Generates corresponding d.ts files.
  166. @default false
  167. */
  168. declaration?: boolean;
  169. /**
  170. Specify output directory for generated declaration files.
  171. Requires TypeScript version 2.0 or later.
  172. */
  173. declarationDir?: string;
  174. /**
  175. Show diagnostic information.
  176. @default false
  177. */
  178. diagnostics?: boolean;
  179. /**
  180. Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.
  181. @default false
  182. */
  183. emitBOM?: boolean;
  184. /**
  185. Only emit `.d.ts` declaration files.
  186. @default false
  187. */
  188. emitDeclarationOnly?: boolean;
  189. /**
  190. Enable incremental compilation.
  191. @default `composite`
  192. */
  193. incremental?: boolean;
  194. /**
  195. Specify file to store incremental compilation information.
  196. @default '.tsbuildinfo'
  197. */
  198. tsBuildInfoFile?: string;
  199. /**
  200. Emit a single file with source maps instead of having a separate file.
  201. @default false
  202. */
  203. inlineSourceMap?: boolean;
  204. /**
  205. Emit the source alongside the sourcemaps within a single file.
  206. Requires `--inlineSourceMap` to be set.
  207. @default false
  208. */
  209. inlineSources?: boolean;
  210. /**
  211. Specify JSX code generation: `'preserve'`, `'react'`, or `'react-native'`.
  212. @default 'preserve'
  213. */
  214. jsx?: CompilerOptions.JSX;
  215. /**
  216. Specifies the object invoked for `createElement` and `__spread` when targeting `'react'` JSX emit.
  217. @default 'React'
  218. */
  219. reactNamespace?: string;
  220. /**
  221. Print names of files part of the compilation.
  222. @default false
  223. */
  224. listFiles?: boolean;
  225. /**
  226. Specifies the location where debugger should locate map files instead of generated locations.
  227. */
  228. mapRoot?: string;
  229. /**
  230. Specify module code generation: 'None', 'CommonJS', 'AMD', 'System', 'UMD', 'ES6', 'ES2015' or 'ESNext'. Only 'AMD' and 'System' can be used in conjunction with `--outFile`. 'ES6' and 'ES2015' values may be used when targeting 'ES5' or lower.
  231. @default ['ES3', 'ES5'].includes(target) ? 'CommonJS' : 'ES6'
  232. */
  233. module?: CompilerOptions.Module;
  234. /**
  235. Specifies the end of line sequence to be used when emitting files: 'crlf' (Windows) or 'lf' (Unix).
  236. Default: Platform specific
  237. */
  238. newLine?: CompilerOptions.NewLine;
  239. /**
  240. Do not emit output.
  241. @default false
  242. */
  243. noEmit?: boolean;
  244. /**
  245. Do not generate custom helper functions like `__extends` in compiled output.
  246. @default false
  247. */
  248. noEmitHelpers?: boolean;
  249. /**
  250. Do not emit outputs if any type checking errors were reported.
  251. @default false
  252. */
  253. noEmitOnError?: boolean;
  254. /**
  255. Warn on expressions and declarations with an implied 'any' type.
  256. @default false
  257. */
  258. noImplicitAny?: boolean;
  259. /**
  260. Raise error on 'this' expressions with an implied any type.
  261. @default false
  262. */
  263. noImplicitThis?: boolean;
  264. /**
  265. Report errors on unused locals.
  266. Requires TypeScript version 2.0 or later.
  267. @default false
  268. */
  269. noUnusedLocals?: boolean;
  270. /**
  271. Report errors on unused parameters.
  272. Requires TypeScript version 2.0 or later.
  273. @default false
  274. */
  275. noUnusedParameters?: boolean;
  276. /**
  277. Do not include the default library file (lib.d.ts).
  278. @default false
  279. */
  280. noLib?: boolean;
  281. /**
  282. Do not add triple-slash references or module import targets to the list of compiled files.
  283. @default false
  284. */
  285. noResolve?: boolean;
  286. /**
  287. Disable strict checking of generic signatures in function types.
  288. @default false
  289. */
  290. noStrictGenericChecks?: boolean;
  291. /**
  292. @deprecated use `skipLibCheck` instead.
  293. */
  294. skipDefaultLibCheck?: boolean;
  295. /**
  296. Skip type checking of declaration files.
  297. Requires TypeScript version 2.0 or later.
  298. @default false
  299. */
  300. skipLibCheck?: boolean;
  301. /**
  302. Concatenate and emit output to single file.
  303. */
  304. outFile?: string;
  305. /**
  306. Redirect output structure to the directory.
  307. */
  308. outDir?: string;
  309. /**
  310. Do not erase const enum declarations in generated code.
  311. @default false
  312. */
  313. preserveConstEnums?: boolean;
  314. /**
  315. Do not resolve symlinks to their real path; treat a symlinked file like a real one.
  316. @default false
  317. */
  318. preserveSymlinks?: boolean;
  319. /**
  320. Keep outdated console output in watch mode instead of clearing the screen.
  321. @default false
  322. */
  323. preserveWatchOutput?: boolean;
  324. /**
  325. Stylize errors and messages using color and context (experimental).
  326. @default true // Unless piping to another program or redirecting output to a file.
  327. */
  328. pretty?: boolean;
  329. /**
  330. Do not emit comments to output.
  331. @default false
  332. */
  333. removeComments?: boolean;
  334. /**
  335. Specifies the root directory of input files.
  336. Use to control the output directory structure with `--outDir`.
  337. */
  338. rootDir?: string;
  339. /**
  340. Unconditionally emit imports for unresolved files.
  341. @default false
  342. */
  343. isolatedModules?: boolean;
  344. /**
  345. Generates corresponding '.map' file.
  346. @default false
  347. */
  348. sourceMap?: boolean;
  349. /**
  350. Specifies the location where debugger should locate TypeScript files instead of source locations.
  351. */
  352. sourceRoot?: string;
  353. /**
  354. Suppress excess property checks for object literals.
  355. @default false
  356. */
  357. suppressExcessPropertyErrors?: boolean;
  358. /**
  359. Suppress noImplicitAny errors for indexing objects lacking index signatures.
  360. @default false
  361. */
  362. suppressImplicitAnyIndexErrors?: boolean;
  363. /**
  364. Do not emit declarations for code that has an `@internal` annotation.
  365. */
  366. stripInternal?: boolean;
  367. /**
  368. Specify ECMAScript target version.
  369. @default 'es3'
  370. */
  371. target?: CompilerOptions.Target;
  372. /**
  373. Watch input files.
  374. @default false
  375. */
  376. watch?: boolean;
  377. /**
  378. Enables experimental support for ES7 decorators.
  379. @default false
  380. */
  381. experimentalDecorators?: boolean;
  382. /**
  383. Emit design-type metadata for decorated declarations in source.
  384. @default false
  385. */
  386. emitDecoratorMetadata?: boolean;
  387. /**
  388. Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6).
  389. @default ['AMD', 'System', 'ES6'].includes(module) ? 'classic' : 'node'
  390. */
  391. moduleResolution?: 'classic' | 'node';
  392. /**
  393. Do not report errors on unused labels.
  394. @default false
  395. */
  396. allowUnusedLabels?: boolean;
  397. /**
  398. Report error when not all code paths in function return a value.
  399. @default false
  400. */
  401. noImplicitReturns?: boolean;
  402. /**
  403. Report errors for fallthrough cases in switch statement.
  404. @default false
  405. */
  406. noFallthroughCasesInSwitch?: boolean;
  407. /**
  408. Do not report errors on unreachable code.
  409. @default false
  410. */
  411. allowUnreachableCode?: boolean;
  412. /**
  413. Disallow inconsistently-cased references to the same file.
  414. @default false
  415. */
  416. forceConsistentCasingInFileNames?: boolean;
  417. /**
  418. Base directory to resolve non-relative module names.
  419. */
  420. baseUrl?: string;
  421. /**
  422. Specify path mapping to be computed relative to baseUrl option.
  423. */
  424. paths?: {
  425. [key: string]: string[];
  426. };
  427. /**
  428. List of TypeScript language server plugins to load.
  429. Requires TypeScript version 2.3 or later.
  430. */
  431. plugins?: CompilerOptions.Plugin[];
  432. /**
  433. Specify list of root directories to be used when resolving modules.
  434. */
  435. rootDirs?: string[];
  436. /**
  437. Specify list of directories for type definition files to be included.
  438. Requires TypeScript version 2.0 or later.
  439. */
  440. typeRoots?: string[];
  441. /**
  442. Type declaration files to be included in compilation.
  443. Requires TypeScript version 2.0 or later.
  444. */
  445. types?: string[];
  446. /**
  447. Enable tracing of the name resolution process.
  448. @default false
  449. */
  450. traceResolution?: boolean;
  451. /**
  452. Allow javascript files to be compiled.
  453. @default false
  454. */
  455. allowJs?: boolean;
  456. /**
  457. Do not truncate error messages.
  458. @default false
  459. */
  460. noErrorTruncation?: boolean;
  461. /**
  462. Allow default imports from modules with no default export. This does not affect code emit, just typechecking.
  463. @default module === 'system' || esModuleInterop
  464. */
  465. allowSyntheticDefaultImports?: boolean;
  466. /**
  467. Do not emit `'use strict'` directives in module output.
  468. @default false
  469. */
  470. noImplicitUseStrict?: boolean;
  471. /**
  472. Enable to list all emitted files.
  473. Requires TypeScript version 2.0 or later.
  474. @default false
  475. */
  476. listEmittedFiles?: boolean;
  477. /**
  478. Disable size limit for JavaScript project.
  479. Requires TypeScript version 2.0 or later.
  480. @default false
  481. */
  482. disableSizeLimit?: boolean;
  483. /**
  484. List of library files to be included in the compilation.
  485. Requires TypeScript version 2.0 or later.
  486. */
  487. lib?: CompilerOptions.Lib[];
  488. /**
  489. Enable strict null checks.
  490. Requires TypeScript version 2.0 or later.
  491. @default false
  492. */
  493. strictNullChecks?: boolean;
  494. /**
  495. The maximum dependency depth to search under `node_modules` and load JavaScript files. Only applicable with `--allowJs`.
  496. @default 0
  497. */
  498. maxNodeModuleJsDepth?: number;
  499. /**
  500. Import emit helpers (e.g. `__extends`, `__rest`, etc..) from tslib.
  501. Requires TypeScript version 2.1 or later.
  502. @default false
  503. */
  504. importHelpers?: boolean;
  505. /**
  506. Specify the JSX factory function to use when targeting React JSX emit, e.g. `React.createElement` or `h`.
  507. Requires TypeScript version 2.1 or later.
  508. @default 'React.createElement'
  509. */
  510. jsxFactory?: string;
  511. /**
  512. Parse in strict mode and emit `'use strict'` for each source file.
  513. Requires TypeScript version 2.1 or later.
  514. @default false
  515. */
  516. alwaysStrict?: boolean;
  517. /**
  518. Enable all strict type checking options.
  519. Requires TypeScript version 2.3 or later.
  520. @default false
  521. */
  522. strict?: boolean;
  523. /**
  524. Enable stricter checking of of the `bind`, `call`, and `apply` methods on functions.
  525. @default false
  526. */
  527. strictBindCallApply?: boolean;
  528. /**
  529. Provide full support for iterables in `for-of`, spread, and destructuring when targeting `ES5` or `ES3`.
  530. Requires TypeScript version 2.3 or later.
  531. @default false
  532. */
  533. downlevelIteration?: boolean;
  534. /**
  535. Report errors in `.js` files.
  536. Requires TypeScript version 2.3 or later.
  537. @default false
  538. */
  539. checkJs?: boolean;
  540. /**
  541. Disable bivariant parameter checking for function types.
  542. Requires TypeScript version 2.6 or later.
  543. @default false
  544. */
  545. strictFunctionTypes?: boolean;
  546. /**
  547. Ensure non-undefined class properties are initialized in the constructor.
  548. Requires TypeScript version 2.7 or later.
  549. @default false
  550. */
  551. strictPropertyInitialization?: boolean;
  552. /**
  553. Emit `__importStar` and `__importDefault` helpers for runtime Babel ecosystem compatibility and enable `--allowSyntheticDefaultImports` for typesystem compatibility.
  554. Requires TypeScript version 2.7 or later.
  555. @default false
  556. */
  557. esModuleInterop?: boolean;
  558. /**
  559. Allow accessing UMD globals from modules.
  560. @default false
  561. */
  562. allowUmdGlobalAccess?: boolean;
  563. /**
  564. Resolve `keyof` to string valued property names only (no numbers or symbols).
  565. Requires TypeScript version 2.9 or later.
  566. @default false
  567. */
  568. keyofStringsOnly?: boolean;
  569. /**
  570. Emit ECMAScript standard class fields.
  571. Requires TypeScript version 3.7 or later.
  572. @default false
  573. */
  574. useDefineForClassFields?: boolean;
  575. /**
  576. Generates a sourcemap for each corresponding `.d.ts` file.
  577. Requires TypeScript version 2.9 or later.
  578. @default false
  579. */
  580. declarationMap?: boolean;
  581. /**
  582. Include modules imported with `.json` extension.
  583. Requires TypeScript version 2.9 or later.
  584. @default false
  585. */
  586. resolveJsonModule?: boolean;
  587. }
  588. /**
  589. Auto type (.d.ts) acquisition options for this project.
  590. Requires TypeScript version 2.1 or later.
  591. */
  592. export interface TypeAcquisition {
  593. /**
  594. Enable auto type acquisition.
  595. */
  596. enable?: boolean;
  597. /**
  598. Specifies a list of type declarations to be included in auto type acquisition. For example, `['jquery', 'lodash']`.
  599. */
  600. include?: string[];
  601. /**
  602. Specifies a list of type declarations to be excluded from auto type acquisition. For example, `['jquery', 'lodash']`.
  603. */
  604. exclude?: string[];
  605. }
  606. export interface References {
  607. /**
  608. A normalized path on disk.
  609. */
  610. path: string;
  611. /**
  612. The path as the user originally wrote it.
  613. */
  614. originalPath?: string;
  615. /**
  616. True if the output of this reference should be prepended to the output of this project.
  617. Only valid for `--outFile` compilations.
  618. */
  619. prepend?: boolean;
  620. /**
  621. True if it is intended that this reference form a circularity.
  622. */
  623. circular?: boolean;
  624. }
  625. }
  626. export interface TsConfigJson {
  627. /**
  628. Instructs the TypeScript compiler how to compile `.ts` files.
  629. */
  630. compilerOptions?: TsConfigJson.CompilerOptions;
  631. /**
  632. Auto type (.d.ts) acquisition options for this project.
  633. Requires TypeScript version 2.1 or later.
  634. */
  635. typeAcquisition?: TsConfigJson.TypeAcquisition;
  636. /**
  637. Enable Compile-on-Save for this project.
  638. */
  639. compileOnSave?: boolean;
  640. /**
  641. Path to base configuration file to inherit from.
  642. Requires TypeScript version 2.1 or later.
  643. */
  644. extends?: string;
  645. /**
  646. 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.
  647. */
  648. files?: string[];
  649. /**
  650. 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.
  651. Glob patterns require TypeScript version 2.0 or later.
  652. */
  653. exclude?: string[];
  654. /**
  655. Specifies a list of glob patterns that match files to be included in compilation.
  656. 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`.
  657. Requires TypeScript version 2.0 or later.
  658. */
  659. include?: string[];
  660. /**
  661. Referenced projects.
  662. Requires TypeScript version 3.0 or later.
  663. */
  664. references?: TsConfigJson.References[];
  665. }