UNPKG

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