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