index.d.mts 28 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324
  1. declare global {
  2. // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
  3. interface SymbolConstructor {
  4. readonly observable: symbol;
  5. }
  6. }
  7. /**
  8. Returns a boolean for whether the two given types are equal.
  9. @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
  10. @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
  11. Use-cases:
  12. - If you want to make a conditional branch based on the result of a comparison of two types.
  13. @example
  14. ```
  15. import type {IsEqual} from 'type-fest';
  16. // This type returns a boolean for whether the given array includes the given item.
  17. // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
  18. type Includes<Value extends readonly any[], Item> =
  19. Value extends readonly [Value[0], ...infer rest]
  20. ? IsEqual<Value[0], Item> extends true
  21. ? true
  22. : Includes<rest, Item>
  23. : false;
  24. ```
  25. @category Type Guard
  26. @category Utilities
  27. */
  28. type IsEqual<A, B> =
  29. (<G>() => G extends A ? 1 : 2) extends
  30. (<G>() => G extends B ? 1 : 2)
  31. ? true
  32. : false;
  33. /**
  34. Filter out keys from an object.
  35. Returns `never` if `Exclude` is strictly equal to `Key`.
  36. Returns `never` if `Key` extends `Exclude`.
  37. Returns `Key` otherwise.
  38. @example
  39. ```
  40. type Filtered = Filter<'foo', 'foo'>;
  41. //=> never
  42. ```
  43. @example
  44. ```
  45. type Filtered = Filter<'bar', string>;
  46. //=> never
  47. ```
  48. @example
  49. ```
  50. type Filtered = Filter<'bar', 'foo'>;
  51. //=> 'bar'
  52. ```
  53. @see {Except}
  54. */
  55. type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
  56. type ExceptOptions = {
  57. /**
  58. Disallow assigning non-specified properties.
  59. Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
  60. @default false
  61. */
  62. requireExactProps?: boolean;
  63. };
  64. /**
  65. Create a type from an object type without certain keys.
  66. We recommend setting the `requireExactProps` option to `true`.
  67. This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
  68. This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
  69. @example
  70. ```
  71. import type {Except} from 'type-fest';
  72. type Foo = {
  73. a: number;
  74. b: string;
  75. };
  76. type FooWithoutA = Except<Foo, 'a'>;
  77. //=> {b: string}
  78. const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
  79. //=> errors: 'a' does not exist in type '{ b: string; }'
  80. type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
  81. //=> {a: number} & Partial<Record<"b", never>>
  82. const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
  83. //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
  84. ```
  85. @category Object
  86. */
  87. type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
  88. [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
  89. } & (Options['requireExactProps'] extends true
  90. ? Partial<Record<KeysType, never>>
  91. : {});
  92. declare namespace TsConfigJson {
  93. namespace CompilerOptions {
  94. export type JSX =
  95. | 'preserve'
  96. | 'react'
  97. | 'react-jsx'
  98. | 'react-jsxdev'
  99. | 'react-native';
  100. export type Module =
  101. | 'CommonJS'
  102. | 'AMD'
  103. | 'System'
  104. | 'UMD'
  105. | 'ES6'
  106. | 'ES2015'
  107. | 'ES2020'
  108. | 'ES2022'
  109. | 'ESNext'
  110. | 'Node16'
  111. | 'NodeNext'
  112. | 'None'
  113. // Lowercase alternatives
  114. | 'commonjs'
  115. | 'amd'
  116. | 'system'
  117. | 'umd'
  118. | 'es6'
  119. | 'es2015'
  120. | 'es2020'
  121. | 'es2022'
  122. | 'esnext'
  123. | 'node16'
  124. | 'nodenext'
  125. | 'none';
  126. export type NewLine =
  127. | 'CRLF'
  128. | 'LF'
  129. // Lowercase alternatives
  130. | 'crlf'
  131. | 'lf';
  132. export type Target =
  133. | 'ES3'
  134. | 'ES5'
  135. | 'ES6'
  136. | 'ES2015'
  137. | 'ES2016'
  138. | 'ES2017'
  139. | 'ES2018'
  140. | 'ES2019'
  141. | 'ES2020'
  142. | 'ES2021'
  143. | 'ES2022'
  144. | 'ESNext'
  145. // Lowercase alternatives
  146. | 'es3'
  147. | 'es5'
  148. | 'es6'
  149. | 'es2015'
  150. | 'es2016'
  151. | 'es2017'
  152. | 'es2018'
  153. | 'es2019'
  154. | 'es2020'
  155. | 'es2021'
  156. | 'es2022'
  157. | 'esnext';
  158. export type Lib =
  159. | 'ES5'
  160. | 'ES6'
  161. | 'ES7'
  162. | 'ES2015'
  163. | 'ES2015.Collection'
  164. | 'ES2015.Core'
  165. | 'ES2015.Generator'
  166. | 'ES2015.Iterable'
  167. | 'ES2015.Promise'
  168. | 'ES2015.Proxy'
  169. | 'ES2015.Reflect'
  170. | 'ES2015.Symbol.WellKnown'
  171. | 'ES2015.Symbol'
  172. | 'ES2016'
  173. | 'ES2016.Array.Include'
  174. | 'ES2017'
  175. | 'ES2017.Intl'
  176. | 'ES2017.Object'
  177. | 'ES2017.SharedMemory'
  178. | 'ES2017.String'
  179. | 'ES2017.TypedArrays'
  180. | 'ES2018'
  181. | 'ES2018.AsyncGenerator'
  182. | 'ES2018.AsyncIterable'
  183. | 'ES2018.Intl'
  184. | 'ES2018.Promise'
  185. | 'ES2018.Regexp'
  186. | 'ES2019'
  187. | 'ES2019.Array'
  188. | 'ES2019.Object'
  189. | 'ES2019.String'
  190. | 'ES2019.Symbol'
  191. | 'ES2020'
  192. | 'ES2020.BigInt'
  193. | 'ES2020.Promise'
  194. | 'ES2020.String'
  195. | 'ES2020.Symbol.WellKnown'
  196. | 'ES2020.SharedMemory'
  197. | 'ES2020.Intl'
  198. | 'ES2021'
  199. | 'ES2021.Promise'
  200. | 'ES2021.String'
  201. | 'ES2021.WeakRef'
  202. | 'ESNext'
  203. | 'ESNext.Array'
  204. | 'ESNext.AsyncIterable'
  205. | 'ESNext.BigInt'
  206. | 'ESNext.Intl'
  207. | 'ESNext.Promise'
  208. | 'ESNext.String'
  209. | 'ESNext.Symbol'
  210. | 'ESNext.WeakRef'
  211. | 'DOM'
  212. | 'DOM.Iterable'
  213. | 'ScriptHost'
  214. | 'WebWorker'
  215. | 'WebWorker.ImportScripts'
  216. | 'WebWorker.Iterable'
  217. // Lowercase alternatives
  218. | 'es5'
  219. | 'es6'
  220. | 'es7'
  221. | 'es2015'
  222. | 'es2015.collection'
  223. | 'es2015.core'
  224. | 'es2015.generator'
  225. | 'es2015.iterable'
  226. | 'es2015.promise'
  227. | 'es2015.proxy'
  228. | 'es2015.reflect'
  229. | 'es2015.symbol.wellknown'
  230. | 'es2015.symbol'
  231. | 'es2016'
  232. | 'es2016.array.include'
  233. | 'es2017'
  234. | 'es2017.intl'
  235. | 'es2017.object'
  236. | 'es2017.sharedmemory'
  237. | 'es2017.string'
  238. | 'es2017.typedarrays'
  239. | 'es2018'
  240. | 'es2018.asyncgenerator'
  241. | 'es2018.asynciterable'
  242. | 'es2018.intl'
  243. | 'es2018.promise'
  244. | 'es2018.regexp'
  245. | 'es2019'
  246. | 'es2019.array'
  247. | 'es2019.object'
  248. | 'es2019.string'
  249. | 'es2019.symbol'
  250. | 'es2020'
  251. | 'es2020.bigint'
  252. | 'es2020.promise'
  253. | 'es2020.string'
  254. | 'es2020.symbol.wellknown'
  255. | 'es2020.sharedmemory'
  256. | 'es2020.intl'
  257. | 'es2021'
  258. | 'es2021.promise'
  259. | 'es2021.string'
  260. | 'es2021.weakref'
  261. | 'esnext'
  262. | 'esnext.array'
  263. | 'esnext.asynciterable'
  264. | 'esnext.bigint'
  265. | 'esnext.intl'
  266. | 'esnext.promise'
  267. | 'esnext.string'
  268. | 'esnext.symbol'
  269. | 'esnext.weakref'
  270. | 'dom'
  271. | 'dom.iterable'
  272. | 'scripthost'
  273. | 'webworker'
  274. | 'webworker.importscripts'
  275. | 'webworker.iterable';
  276. export type Plugin = {
  277. /**
  278. Plugin name.
  279. */
  280. name: string;
  281. };
  282. export type ImportsNotUsedAsValues =
  283. | 'remove'
  284. | 'preserve'
  285. | 'error';
  286. export type FallbackPolling =
  287. | 'fixedPollingInterval'
  288. | 'priorityPollingInterval'
  289. | 'dynamicPriorityPolling'
  290. | 'fixedInterval'
  291. | 'priorityInterval'
  292. | 'dynamicPriority'
  293. | 'fixedChunkSize';
  294. export type WatchDirectory =
  295. | 'useFsEvents'
  296. | 'fixedPollingInterval'
  297. | 'dynamicPriorityPolling'
  298. | 'fixedChunkSizePolling';
  299. export type WatchFile =
  300. | 'fixedPollingInterval'
  301. | 'priorityPollingInterval'
  302. | 'dynamicPriorityPolling'
  303. | 'useFsEvents'
  304. | 'useFsEventsOnParentDirectory'
  305. | 'fixedChunkSizePolling';
  306. export type ModuleResolution =
  307. | 'classic'
  308. | 'node'
  309. | 'node10'
  310. | 'node16'
  311. | 'nodenext'
  312. | 'bundler'
  313. // Pascal-cased alternatives
  314. | 'Classic'
  315. | 'Node'
  316. | 'Node10'
  317. | 'Node16'
  318. | 'NodeNext'
  319. | 'Bundler';
  320. export type ModuleDetection =
  321. | 'auto'
  322. | 'legacy'
  323. | 'force';
  324. export type IgnoreDeprecations = '5.0';
  325. }
  326. export type CompilerOptions = {
  327. /**
  328. The character set of the input files.
  329. @default 'utf8'
  330. @deprecated This option will be removed in TypeScript 5.5.
  331. */
  332. charset?: string;
  333. /**
  334. Enables building for project references.
  335. @default true
  336. */
  337. composite?: boolean;
  338. /**
  339. Generates corresponding d.ts files.
  340. @default false
  341. */
  342. declaration?: boolean;
  343. /**
  344. Specify output directory for generated declaration files.
  345. */
  346. declarationDir?: string;
  347. /**
  348. Show diagnostic information.
  349. @default false
  350. */
  351. diagnostics?: boolean;
  352. /**
  353. Reduce the number of projects loaded automatically by TypeScript.
  354. @default false
  355. */
  356. disableReferencedProjectLoad?: boolean;
  357. /**
  358. Enforces using indexed accessors for keys declared using an indexed type.
  359. @default false
  360. */
  361. noPropertyAccessFromIndexSignature?: boolean;
  362. /**
  363. Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.
  364. @default false
  365. */
  366. emitBOM?: boolean;
  367. /**
  368. Only emit `.d.ts` declaration files.
  369. @default false
  370. */
  371. emitDeclarationOnly?: boolean;
  372. /**
  373. Differentiate between undefined and not present when type checking.
  374. @default false
  375. */
  376. exactOptionalPropertyTypes?: boolean;
  377. /**
  378. Enable incremental compilation.
  379. @default `composite`
  380. */
  381. incremental?: boolean;
  382. /**
  383. Specify file to store incremental compilation information.
  384. @default '.tsbuildinfo'
  385. */
  386. tsBuildInfoFile?: string;
  387. /**
  388. Emit a single file with source maps instead of having a separate file.
  389. @default false
  390. */
  391. inlineSourceMap?: boolean;
  392. /**
  393. Emit the source alongside the sourcemaps within a single file.
  394. Requires `--inlineSourceMap` to be set.
  395. @default false
  396. */
  397. inlineSources?: boolean;
  398. /**
  399. Specify what JSX code is generated.
  400. @default 'preserve'
  401. */
  402. jsx?: CompilerOptions.JSX;
  403. /**
  404. Specifies the object invoked for `createElement` and `__spread` when targeting `'react'` JSX emit.
  405. @default 'React'
  406. */
  407. reactNamespace?: string;
  408. /**
  409. Specify the JSX factory function to use when targeting React JSX emit, e.g. `React.createElement` or `h`.
  410. @default 'React.createElement'
  411. */
  412. jsxFactory?: string;
  413. /**
  414. Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'.
  415. @default 'React.Fragment'
  416. */
  417. jsxFragmentFactory?: string;
  418. /**
  419. Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.
  420. @default 'react'
  421. */
  422. jsxImportSource?: string;
  423. /**
  424. Print names of files part of the compilation.
  425. @default false
  426. */
  427. listFiles?: boolean;
  428. /**
  429. Specifies the location where debugger should locate map files instead of generated locations.
  430. */
  431. mapRoot?: string;
  432. /**
  433. 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.
  434. @default ['ES3', 'ES5'].includes(target) ? 'CommonJS' : 'ES6'
  435. */
  436. module?: CompilerOptions.Module;
  437. /**
  438. Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6).
  439. @default ['AMD', 'System', 'ES6'].includes(module) ? 'classic' : 'node'
  440. */
  441. moduleResolution?: CompilerOptions.ModuleResolution;
  442. /**
  443. Specifies the end of line sequence to be used when emitting files: 'crlf' (Windows) or 'lf' (Unix).
  444. @default 'LF'
  445. */
  446. newLine?: CompilerOptions.NewLine;
  447. /**
  448. Do not emit output.
  449. @default false
  450. */
  451. noEmit?: boolean;
  452. /**
  453. Do not generate custom helper functions like `__extends` in compiled output.
  454. @default false
  455. */
  456. noEmitHelpers?: boolean;
  457. /**
  458. Do not emit outputs if any type checking errors were reported.
  459. @default false
  460. */
  461. noEmitOnError?: boolean;
  462. /**
  463. Warn on expressions and declarations with an implied 'any' type.
  464. @default false
  465. */
  466. noImplicitAny?: boolean;
  467. /**
  468. Raise error on 'this' expressions with an implied any type.
  469. @default false
  470. */
  471. noImplicitThis?: boolean;
  472. /**
  473. Report errors on unused locals.
  474. @default false
  475. */
  476. noUnusedLocals?: boolean;
  477. /**
  478. Report errors on unused parameters.
  479. @default false
  480. */
  481. noUnusedParameters?: boolean;
  482. /**
  483. Do not include the default library file (lib.d.ts).
  484. @default false
  485. */
  486. noLib?: boolean;
  487. /**
  488. Do not add triple-slash references or module import targets to the list of compiled files.
  489. @default false
  490. */
  491. noResolve?: boolean;
  492. /**
  493. Disable strict checking of generic signatures in function types.
  494. @default false
  495. @deprecated This option will be removed in TypeScript 5.5.
  496. */
  497. noStrictGenericChecks?: boolean;
  498. /**
  499. @deprecated use `skipLibCheck` instead.
  500. */
  501. skipDefaultLibCheck?: boolean;
  502. /**
  503. Skip type checking of declaration files.
  504. @default false
  505. */
  506. skipLibCheck?: boolean;
  507. /**
  508. Concatenate and emit output to single file.
  509. */
  510. outFile?: string;
  511. /**
  512. Redirect output structure to the directory.
  513. */
  514. outDir?: string;
  515. /**
  516. Do not erase const enum declarations in generated code.
  517. @default false
  518. */
  519. preserveConstEnums?: boolean;
  520. /**
  521. Do not resolve symlinks to their real path; treat a symlinked file like a real one.
  522. @default false
  523. */
  524. preserveSymlinks?: boolean;
  525. /**
  526. Keep outdated console output in watch mode instead of clearing the screen.
  527. @default false
  528. */
  529. preserveWatchOutput?: boolean;
  530. /**
  531. Stylize errors and messages using color and context (experimental).
  532. @default true // Unless piping to another program or redirecting output to a file.
  533. */
  534. pretty?: boolean;
  535. /**
  536. Do not emit comments to output.
  537. @default false
  538. */
  539. removeComments?: boolean;
  540. /**
  541. Specifies the root directory of input files.
  542. Use to control the output directory structure with `--outDir`.
  543. */
  544. rootDir?: string;
  545. /**
  546. Unconditionally emit imports for unresolved files.
  547. @default false
  548. */
  549. isolatedModules?: boolean;
  550. /**
  551. Generates corresponding '.map' file.
  552. @default false
  553. */
  554. sourceMap?: boolean;
  555. /**
  556. Specifies the location where debugger should locate TypeScript files instead of source locations.
  557. */
  558. sourceRoot?: string;
  559. /**
  560. Suppress excess property checks for object literals.
  561. @default false
  562. @deprecated This option will be removed in TypeScript 5.5.
  563. */
  564. suppressExcessPropertyErrors?: boolean;
  565. /**
  566. Suppress noImplicitAny errors for indexing objects lacking index signatures.
  567. @default false
  568. @deprecated This option will be removed in TypeScript 5.5.
  569. */
  570. suppressImplicitAnyIndexErrors?: boolean;
  571. /**
  572. Do not emit declarations for code that has an `@internal` annotation.
  573. */
  574. stripInternal?: boolean;
  575. /**
  576. Specify ECMAScript target version.
  577. @default 'es3'
  578. */
  579. target?: CompilerOptions.Target;
  580. /**
  581. Default catch clause variables as `unknown` instead of `any`.
  582. @default false
  583. */
  584. useUnknownInCatchVariables?: boolean;
  585. /**
  586. Watch input files.
  587. @default false
  588. @deprecated Use watchOptions instead.
  589. */
  590. watch?: boolean;
  591. /**
  592. Specify the polling strategy to use when the system runs out of or doesn't support native file watchers.
  593. @deprecated Use watchOptions.fallbackPolling instead.
  594. */
  595. fallbackPolling?: CompilerOptions.FallbackPolling;
  596. /**
  597. Specify the strategy for watching directories under systems that lack recursive file-watching functionality.
  598. @default 'useFsEvents'
  599. @deprecated Use watchOptions.watchDirectory instead.
  600. */
  601. watchDirectory?: CompilerOptions.WatchDirectory;
  602. /**
  603. Specify the strategy for watching individual files.
  604. @default 'useFsEvents'
  605. @deprecated Use watchOptions.watchFile instead.
  606. */
  607. watchFile?: CompilerOptions.WatchFile;
  608. /**
  609. Enables experimental support for ES7 decorators.
  610. @default false
  611. */
  612. experimentalDecorators?: boolean;
  613. /**
  614. Emit design-type metadata for decorated declarations in source.
  615. @default false
  616. */
  617. emitDecoratorMetadata?: boolean;
  618. /**
  619. Do not report errors on unused labels.
  620. @default false
  621. */
  622. allowUnusedLabels?: boolean;
  623. /**
  624. Report error when not all code paths in function return a value.
  625. @default false
  626. */
  627. noImplicitReturns?: boolean;
  628. /**
  629. Add `undefined` to a type when accessed using an index.
  630. @default false
  631. */
  632. noUncheckedIndexedAccess?: boolean;
  633. /**
  634. Report errors for fallthrough cases in switch statement.
  635. @default false
  636. */
  637. noFallthroughCasesInSwitch?: boolean;
  638. /**
  639. Ensure overriding members in derived classes are marked with an override modifier.
  640. @default false
  641. */
  642. noImplicitOverride?: boolean;
  643. /**
  644. Do not report errors on unreachable code.
  645. @default false
  646. */
  647. allowUnreachableCode?: boolean;
  648. /**
  649. Disallow inconsistently-cased references to the same file.
  650. @default true
  651. */
  652. forceConsistentCasingInFileNames?: boolean;
  653. /**
  654. Emit a v8 CPU profile of the compiler run for debugging.
  655. @default 'profile.cpuprofile'
  656. */
  657. generateCpuProfile?: string;
  658. /**
  659. Base directory to resolve non-relative module names.
  660. */
  661. baseUrl?: string;
  662. /**
  663. Specify path mapping to be computed relative to baseUrl option.
  664. */
  665. paths?: Record<string, string[]>;
  666. /**
  667. List of TypeScript language server plugins to load.
  668. */
  669. plugins?: CompilerOptions.Plugin[];
  670. /**
  671. Specify list of root directories to be used when resolving modules.
  672. */
  673. rootDirs?: string[];
  674. /**
  675. Specify list of directories for type definition files to be included.
  676. */
  677. typeRoots?: string[];
  678. /**
  679. Type declaration files to be included in compilation.
  680. */
  681. types?: string[];
  682. /**
  683. Enable tracing of the name resolution process.
  684. @default false
  685. */
  686. traceResolution?: boolean;
  687. /**
  688. Allow javascript files to be compiled.
  689. @default false
  690. */
  691. allowJs?: boolean;
  692. /**
  693. Do not truncate error messages.
  694. @default false
  695. */
  696. noErrorTruncation?: boolean;
  697. /**
  698. Allow default imports from modules with no default export. This does not affect code emit, just typechecking.
  699. @default module === 'system' || esModuleInterop
  700. */
  701. allowSyntheticDefaultImports?: boolean;
  702. /**
  703. Do not emit `'use strict'` directives in module output.
  704. @default false
  705. @deprecated This option will be removed in TypeScript 5.5.
  706. */
  707. noImplicitUseStrict?: boolean;
  708. /**
  709. Enable to list all emitted files.
  710. @default false
  711. */
  712. listEmittedFiles?: boolean;
  713. /**
  714. Disable size limit for JavaScript project.
  715. @default false
  716. */
  717. disableSizeLimit?: boolean;
  718. /**
  719. List of library files to be included in the compilation.
  720. */
  721. lib?: CompilerOptions.Lib[];
  722. /**
  723. Enable strict null checks.
  724. @default false
  725. */
  726. strictNullChecks?: boolean;
  727. /**
  728. The maximum dependency depth to search under `node_modules` and load JavaScript files. Only applicable with `--allowJs`.
  729. @default 0
  730. */
  731. maxNodeModuleJsDepth?: number;
  732. /**
  733. Import emit helpers (e.g. `__extends`, `__rest`, etc..) from tslib.
  734. @default false
  735. */
  736. importHelpers?: boolean;
  737. /**
  738. Specify emit/checking behavior for imports that are only used for types.
  739. @default 'remove'
  740. @deprecated Use `verbatimModuleSyntax` instead.
  741. */
  742. importsNotUsedAsValues?: CompilerOptions.ImportsNotUsedAsValues;
  743. /**
  744. Parse in strict mode and emit `'use strict'` for each source file.
  745. @default false
  746. */
  747. alwaysStrict?: boolean;
  748. /**
  749. Enable all strict type checking options.
  750. @default false
  751. */
  752. strict?: boolean;
  753. /**
  754. Enable stricter checking of of the `bind`, `call`, and `apply` methods on functions.
  755. @default false
  756. */
  757. strictBindCallApply?: boolean;
  758. /**
  759. Provide full support for iterables in `for-of`, spread, and destructuring when targeting `ES5` or `ES3`.
  760. @default false
  761. */
  762. downlevelIteration?: boolean;
  763. /**
  764. Report errors in `.js` files.
  765. @default false
  766. */
  767. checkJs?: boolean;
  768. /**
  769. Disable bivariant parameter checking for function types.
  770. @default false
  771. */
  772. strictFunctionTypes?: boolean;
  773. /**
  774. Ensure non-undefined class properties are initialized in the constructor.
  775. @default false
  776. */
  777. strictPropertyInitialization?: boolean;
  778. /**
  779. Emit `__importStar` and `__importDefault` helpers for runtime Babel ecosystem compatibility and enable `--allowSyntheticDefaultImports` for typesystem compatibility.
  780. @default false
  781. */
  782. esModuleInterop?: boolean;
  783. /**
  784. Allow accessing UMD globals from modules.
  785. @default false
  786. */
  787. allowUmdGlobalAccess?: boolean;
  788. /**
  789. Resolve `keyof` to string valued property names only (no numbers or symbols).
  790. @default false
  791. @deprecated This option will be removed in TypeScript 5.5.
  792. */
  793. keyofStringsOnly?: boolean;
  794. /**
  795. Emit ECMAScript standard class fields.
  796. @default false
  797. */
  798. useDefineForClassFields?: boolean;
  799. /**
  800. Generates a sourcemap for each corresponding `.d.ts` file.
  801. @default false
  802. */
  803. declarationMap?: boolean;
  804. /**
  805. Include modules imported with `.json` extension.
  806. @default false
  807. */
  808. resolveJsonModule?: boolean;
  809. /**
  810. Have recompiles in '--incremental' and '--watch' assume that changes within a file will only affect files directly depending on it.
  811. @default false
  812. */
  813. assumeChangesOnlyAffectDirectDependencies?: boolean;
  814. /**
  815. Output more detailed compiler performance information after building.
  816. @default false
  817. */
  818. extendedDiagnostics?: boolean;
  819. /**
  820. Print names of files that are part of the compilation and then stop processing.
  821. @default false
  822. */
  823. listFilesOnly?: boolean;
  824. /**
  825. Disable preferring source files instead of declaration files when referencing composite projects.
  826. @default true if composite, false otherwise
  827. */
  828. disableSourceOfProjectReferenceRedirect?: boolean;
  829. /**
  830. Opt a project out of multi-project reference checking when editing.
  831. @default false
  832. */
  833. disableSolutionSearching?: boolean;
  834. /**
  835. Print names of files which TypeScript sees as a part of your project and the reason they are part of the compilation.
  836. @default false
  837. */
  838. explainFiles?: boolean;
  839. /**
  840. Preserve unused imported values in the JavaScript output that would otherwise be removed.
  841. @default true
  842. @deprecated Use `verbatimModuleSyntax` instead.
  843. */
  844. preserveValueImports?: boolean;
  845. /**
  846. List of file name suffixes to search when resolving a module.
  847. */
  848. moduleSuffixes?: string[];
  849. /**
  850. Control what method is used to detect module-format JS files.
  851. @default 'auto'
  852. */
  853. moduleDetection?: CompilerOptions.ModuleDetection;
  854. /**
  855. Allows TypeScript files to import each other with a TypeScript-specific extension like .ts, .mts, or .tsx.
  856. @default false
  857. */
  858. allowImportingTsExtensions?: boolean;
  859. /**
  860. Forces TypeScript to consult the exports field of package.json files if it ever reads from a package in node_modules.
  861. @default false
  862. */
  863. resolvePackageJsonExports?: boolean;
  864. /**
  865. Forces TypeScript to consult the imports field of package.json files when performing a lookup that starts with # from a file whose ancestor directory contains a package.json.
  866. @default false
  867. */
  868. resolvePackageJsonImports?: boolean;
  869. /**
  870. Suppress errors for file formats that TypeScript does not understand.
  871. @default false
  872. */
  873. allowArbitraryExtensions?: boolean;
  874. /**
  875. List of additional conditions that should succeed when TypeScript resolves from package.json.
  876. */
  877. customConditions?: string[];
  878. /**
  879. Anything that uses the type modifier is dropped entirely.
  880. @default false
  881. */
  882. verbatimModuleSyntax?: boolean;
  883. /**
  884. Suppress deprecation warnings
  885. */
  886. ignoreDeprecations?: CompilerOptions.IgnoreDeprecations;
  887. };
  888. namespace WatchOptions {
  889. export type WatchFileKind =
  890. | 'FixedPollingInterval'
  891. | 'PriorityPollingInterval'
  892. | 'DynamicPriorityPolling'
  893. | 'FixedChunkSizePolling'
  894. | 'UseFsEvents'
  895. | 'UseFsEventsOnParentDirectory';
  896. export type WatchDirectoryKind =
  897. | 'UseFsEvents'
  898. | 'FixedPollingInterval'
  899. | 'DynamicPriorityPolling'
  900. | 'FixedChunkSizePolling';
  901. export type PollingWatchKind =
  902. | 'FixedInterval'
  903. | 'PriorityInterval'
  904. | 'DynamicPriority'
  905. | 'FixedChunkSize';
  906. }
  907. export type WatchOptions = {
  908. /**
  909. Specify the strategy for watching individual files.
  910. @default 'UseFsEvents'
  911. */
  912. watchFile?: WatchOptions.WatchFileKind | Lowercase<WatchOptions.WatchFileKind>;
  913. /**
  914. Specify the strategy for watching directories under systems that lack recursive file-watching functionality.
  915. @default 'UseFsEvents'
  916. */
  917. watchDirectory?: WatchOptions.WatchDirectoryKind | Lowercase<WatchOptions.WatchDirectoryKind>;
  918. /**
  919. Specify the polling strategy to use when the system runs out of or doesn't support native file watchers.
  920. */
  921. fallbackPolling?: WatchOptions.PollingWatchKind | Lowercase<WatchOptions.PollingWatchKind>;
  922. /**
  923. Enable synchronous updates on directory watchers for platforms that don't support recursive watching natively.
  924. */
  925. synchronousWatchDirectory?: boolean;
  926. /**
  927. Specifies a list of directories to exclude from watch
  928. */
  929. excludeDirectories?: string[];
  930. /**
  931. Specifies a list of files to exclude from watch
  932. */
  933. excludeFiles?: string[];
  934. };
  935. /**
  936. Auto type (.d.ts) acquisition options for this project.
  937. */
  938. export type TypeAcquisition = {
  939. /**
  940. Enable auto type acquisition.
  941. */
  942. enable?: boolean;
  943. /**
  944. Specifies a list of type declarations to be included in auto type acquisition. For example, `['jquery', 'lodash']`.
  945. */
  946. include?: string[];
  947. /**
  948. Specifies a list of type declarations to be excluded from auto type acquisition. For example, `['jquery', 'lodash']`.
  949. */
  950. exclude?: string[];
  951. };
  952. export type References = {
  953. /**
  954. A normalized path on disk.
  955. */
  956. path: string;
  957. /**
  958. The path as the user originally wrote it.
  959. */
  960. originalPath?: string;
  961. /**
  962. True if the output of this reference should be prepended to the output of this project.
  963. Only valid for `--outFile` compilations.
  964. @deprecated This option will be removed in TypeScript 5.5.
  965. */
  966. prepend?: boolean;
  967. /**
  968. True if it is intended that this reference form a circularity.
  969. */
  970. circular?: boolean;
  971. };
  972. }
  973. /**
  974. Type for [TypeScript's `tsconfig.json` file](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) (TypeScript 3.7).
  975. @category File
  976. */
  977. type TsConfigJson = {
  978. /**
  979. Instructs the TypeScript compiler how to compile `.ts` files.
  980. */
  981. compilerOptions?: TsConfigJson.CompilerOptions;
  982. /**
  983. Instructs the TypeScript compiler how to watch files.
  984. */
  985. watchOptions?: TsConfigJson.WatchOptions;
  986. /**
  987. Auto type (.d.ts) acquisition options for this project.
  988. */
  989. typeAcquisition?: TsConfigJson.TypeAcquisition;
  990. /**
  991. Enable Compile-on-Save for this project.
  992. */
  993. compileOnSave?: boolean;
  994. /**
  995. Path to base configuration file to inherit from.
  996. */
  997. extends?: string | string[];
  998. /**
  999. 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.
  1000. */
  1001. files?: string[];
  1002. /**
  1003. 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.
  1004. Glob patterns require TypeScript version 2.0 or later.
  1005. */
  1006. exclude?: string[];
  1007. /**
  1008. Specifies a list of glob patterns that match files to be included in compilation.
  1009. 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`.
  1010. */
  1011. include?: string[];
  1012. /**
  1013. Referenced projects.
  1014. */
  1015. references?: TsConfigJson.References[];
  1016. };
  1017. type TsConfigJsonResolved = Except<TsConfigJson, 'extends'>;
  1018. type TsConfigResult = {
  1019. /**
  1020. * The path to the tsconfig.json file
  1021. */
  1022. path: string;
  1023. /**
  1024. * The resolved tsconfig.json file
  1025. */
  1026. config: TsConfigJsonResolved;
  1027. };
  1028. declare const getTsconfig: (searchPath?: string, configName?: string, cache?: Map<string, any>) => TsConfigResult | null;
  1029. declare const parseTsconfig: (tsconfigPath: string, cache?: Map<string, any>) => TsConfigJsonResolved;
  1030. /**
  1031. * Reference:
  1032. * https://github.com/microsoft/TypeScript/blob/3ccbe804f850f40d228d3c875be952d94d39aa1d/src/compiler/moduleNameResolver.ts#L2465
  1033. */
  1034. declare const createPathsMatcher: (tsconfig: TsConfigResult) => ((specifier: string) => string[]) | null;
  1035. type FileMatcher = (filePath: string) => (TsConfigJsonResolved | undefined);
  1036. declare const createFilesMatcher: ({ config, path: tsconfigPath, }: TsConfigResult, caseSensitivePaths?: boolean) => FileMatcher;
  1037. export { FileMatcher, TsConfigJson, TsConfigJsonResolved, TsConfigResult, createFilesMatcher, createPathsMatcher, getTsconfig, parseTsconfig };