-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathtsc.ts
731 lines (729 loc) · 19.9 KB
/
tsc.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
import { filepaths } from "@fig/autocomplete-generators";
const completionSpec: Fig.Spec = {
name: "tsc",
description: "CLI tool for TypeScript compiler",
options: [
{
name: "--all",
description: "Show all compiler options",
},
{
name: "--generateTrace",
description: "Generates an event trace and a list of types",
},
{
name: "--help",
description: "Gives local information for help on the CLI",
},
{
name: "--init",
description:
"Initializes a TypeScript project and creates a tsconfig.json file",
},
{
name: "--listFilesOnly",
description:
"Print names of files that are part of the compilation and then stop processing",
},
{
name: "--locale",
description:
"Set the language of the messaging from TypeScript. This does not affect emit",
},
{
name: "--project",
description:
"Compile the project given the path to its configuration file, or to a folder with a tsconfig.json",
args: {
name: "path",
template: ["filepaths", "folders"],
},
},
{
name: "--showConfig",
description: "Print the final configuration instead of building",
},
{
name: "--version",
description: "Print the compiler's version",
},
{
name: "--build",
description:
"Build one or more projects and their dependencies, if out of date",
},
{
name: "--clean",
description: "Delete the outputs of all projects",
},
{
name: "--dry",
description:
"Show what would be built (or deleted, if specified with '--clean')",
},
{
name: "--force",
description:
"Build all projects, including those that appear to be up to date",
},
{
name: "--verbose",
description: "Enable verbose logging",
},
{
name: "--excludeDirectories",
description: "Remove a list of directories from the watch process",
args: {
name: "dir",
template: "folders",
isVariadic: true,
},
},
{
name: "--excludeFiles",
description: "Remove a list of files from the watch mode's processing",
args: {
name: "files",
template: "filepaths",
isVariadic: true,
},
},
{
name: "--fallbackPolling",
description:
"Specify what approach the watcher should use if the system runs out of native file watchers",
args: {
name: "approach",
suggestions: [
"fixedPollingInterval",
"priorityPollingInterval",
"dynamicPriorityPolling",
],
},
},
{
name: "--synchronousWatchDirectory",
description:
"Synchronously call callbacks and update the state of directory watchers on platforms that don`t support recursive watching natively",
},
{
name: "--watch",
description: "Watch input files",
},
{
name: "--watchDirectory",
description:
"Specify how directories are watched on systems that lack recursive file-watching functionality",
args: {
name: "approach",
suggestions: [
"fixedPollingInterval",
"dynamicPriorityPolling",
"useFsEvents",
],
},
},
{
name: "--watchFile",
description: "Specify how the TypeScript watch mode works",
args: {
name: "approach",
suggestions: [
"fixedPollingInterval",
"priorityPollingInterval",
"dynamicPriorityPolling",
"useFsEvents",
"useFsEventsOnParentDirectory",
],
},
},
{
name: "--allowJs",
description:
"Allow JavaScript files to be a part of your program. Use the checkJS option to get errors from these files",
},
{
name: "--allowSyntheticDefaultImports",
description:
"Allow 'import x from y' when a module doesn't have a default export",
},
{
name: "--allowUmdGlobalAccess",
description: "Allow accessing UMD globals from modules",
},
{
name: "--allowUnreachableCode",
description: "Disable error reporting for unreachable code",
},
{
name: "--allowUnusedLabels",
description: "Disable error reporting for unused label",
},
{
name: "--alwaysStrict",
description: "Ensure 'use strict' is always emitted",
},
{
name: "--assumeChangesOnlyAffectDirectDependencies",
description:
"Have recompiles in projects that use incremental and watch mode assume that changes within a file will only affect files directly depending on it",
},
{
name: "--baseUrl",
description:
"Specify the base directory to resolve non-relative module names",
args: {
name: "directory",
template: "filepaths",
},
},
{
name: "--checkJs",
description: "Enable error reporting in type-checked JavaScript files",
},
{
name: "--composite",
description:
"Enable constraints that allow a TypeScript project to be used with project references",
},
{
name: "--declaration",
description:
"Generate .d.ts files from TypeScript and JavaScript files in your project",
},
{
name: "--declarationDir",
description:
"Specify the output directory for generated declaration files",
args: {
name: "string",
template: "folders",
},
},
{
name: "--declarationMap",
description: "Create sourcemaps for d.ts files",
},
{
name: "--diagnostics",
description: "Output compiler performance information after building",
},
{
name: "--disableReferencedProjectLoad",
description:
"Reduce the number of projects loaded automatically by TypeScript",
},
{
name: "--disableSizeLimit",
description:
"Remove the 20mb cap on total source code size for JavaScript files in the TypeScript language server",
},
{
name: "--disableSolutionSearching",
description:
"Opt a project out of multi-project reference checking when editing",
},
{
name: "--disableSourceOfProjectReferenceRedirect",
description:
"Disable preferring source files instead of declaration files when referencing composite projects",
},
{
name: "--downlevelIteration",
description:
"Emit more compliant, but verbose and less performant JavaScript for iteration",
},
{
name: "--emitBOM",
description:
"Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files",
},
{
name: "--emitDeclarationOnly",
description: "Only output d.ts files and not JavaScript files",
},
{
name: "--emitDecoratorMetadata",
description:
"Emit design-type metadata for decorated declarations in source files",
},
{
name: "--esModuleInterop",
description:
"Emit additional JavaScript to ease support for importing CommonJS modules. This enables allowSyntheticDefaultImports for type compatibility",
},
{
name: "--exactOptionalPropertyTypes",
description:
"Differentiate between undefined and not present when type checking",
},
{
name: "--experimentalDecorators",
description:
"Enable experimental support for TC39 stage 2 draft decorators",
},
{
name: "--explainFiles",
description:
"Print files read during the compilation including why it was included",
},
{
name: "--extendedDiagnostics",
description:
"Output more detailed compiler performance information after building",
},
{
name: "--forceConsistentCasingInFileNames",
description: "Ensure that casing is correct in imports",
},
{
name: "--generateCpuProfile",
description: "Emit a v8 CPU profile of the compiler run for debugging",
},
{
name: "--importHelpers",
description:
"Allow importing helper functions from tslib once per project, instead of including them per-file",
},
{
name: "--importsNotUsedAsValues",
description:
"Specify emit/checking behavior for imports that are only used for types",
args: {
name: "type",
suggestions: ["remove", "preserve", "error"],
},
},
{
name: "--incremental",
description:
"Save .tsbuildinfo files to allow for incremental compilation of projects",
},
{
name: "--inlineSourceMap",
description: "Include sourcemap files inside the emitted JavaScript",
},
{
name: "--inlineSources",
description:
"Include source code in the sourcemaps inside the emitted JavaScript",
},
{
name: "--isolatedModules",
description:
"Ensure that each file can be safely transpiled without relying on other imports",
},
{
name: "--jsx",
description: "Specify what JSX code is generated",
args: {
name: "type",
suggestions: [
"react",
"react-jsx",
"react-jsxdev",
"react-native",
"preserve",
],
},
},
{
name: "--jsxFactory",
description:
"Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'",
args: {
name: "JSX factory function",
default: "React.createElement",
},
},
{
name: "--jsxFragmentFactory",
description:
"Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'",
args: {
name: "JSX fragment",
},
},
{
name: "--jsxImportSource",
description:
"Specify module specifier used to import the JSX factory functions when using jsx: react-jsx*",
args: {
name: "string",
default: "react",
},
},
{
name: "--keyofStringsOnly",
description:
"Make keyof only return strings instead of string, numbers or symbols. Legacy option",
},
{
name: "--lib",
description:
"Specify a set of bundled library declaration files that describe the target runtime environment",
args: {
name: "list",
template: "filepaths",
isVariadic: true,
},
},
{
name: "--listEmittedFiles",
description: "Print the names of emitted files after a compilation",
},
{
name: "--listFiles",
description: "Print all of the files read during the compilation",
},
{
name: "--mapRoot",
description:
"Specify the location where debugger should locate map files instead of generated locations",
args: {
name: "string",
template: "folders",
},
},
{
name: "--maxNodeModuleJsDepth",
description:
"Specify the maximum folder depth used for checking JavaScript files from node_modules. Only applicable with allowJs",
dependsOn: ["--allowJs"],
args: {
name: "number",
default: "0",
},
},
{
name: "--module",
description: "Specify what module code is generated",
args: {
name: "module",
default: "CommonJS",
suggestions: [
"ES6",
"ES2015",
"ES2020",
"None",
"UMD",
"AMD",
"System",
"ESNext",
"CommonJS",
],
},
},
{
name: "--moduleResolution",
description:
"Specify how TypeScript looks up a file from a given module specifier",
args: {
name: "module",
},
},
{
name: "--newLine",
description: "Set the newline character for emitting files",
args: {
name: "character",
},
},
{
name: "--noEmit",
description: "Disable emitting file from a compilation",
},
{
name: "--noEmitHelpers",
description:
"Disable generating custom helper functions like __extends in compiled output",
},
{
name: "--noEmitOnError",
description:
"Disable emitting files if any type checking errors are reported",
},
{
name: "--noErrorTruncation",
description: "Disable truncating types in error messages",
},
{
name: "--noFallthroughCasesInSwitch",
description:
"Enable error reporting for fallthrough cases in switch statements",
},
{
name: "--noImplicitAny",
description:
"Enable error reporting for expressions and declarations with an implied any type",
},
{
name: "--noImplicitOverride",
description:
"Ensure overriding members in derived classes are marked with an override modifier",
},
{
name: "--noImplicitReturns",
description:
"Enable error reporting for codepaths that do not explicitly return in a function",
},
{
name: "--noImplicitThis",
description: "Enable error reporting when this is given the type any",
},
{
name: "--noImplicitUseStrict",
description:
"Disable adding 'use strict' directives in emitted JavaScript files",
},
{
name: "--noLib",
description:
"Disable including any library files, including the default lib.d.ts",
},
{
name: "--noPropertyAccessFromIndexSignature",
description:
"Enforces using indexed accessors for keys declared using an indexed type",
},
{
name: "--noResolve",
description:
"Disallow imports, requires or <reference>s from expanding the number of files TypeScript should add to a project",
},
{
name: "--noStrictGenericChecks",
description:
"Disable strict checking of generic signatures in function types",
},
{
name: "--noUncheckedIndexedAccess",
description: "Add undefined to a type when accessed using an index",
},
{
name: "--noUnusedLocals",
description: "Enable error reporting when a local variables aren't read",
},
{
name: "--noUnusedParameters",
description: "Raise an error when a function parameter isn't read",
},
{
name: "--outDir",
description: "Specify an output folder for all emitted files",
args: {
name: "string",
template: "folders",
},
},
{
name: "--outFile",
description:
"Specify a file that bundles all outputs into one JavaScript file. If declaration is true, also designates a file that bundles all .d.ts output",
args: {
name: "string",
template: "filepaths",
},
},
{
name: "--paths",
description:
"Specify a set of entries that re-map imports to additional lookup locations",
args: {
name: "object",
},
},
{
name: "--plugins",
description: "Specify a list of language service plugins to include",
args: {
name: "plugins",
isVariadic: true,
},
},
{
name: "--preserveConstEnums",
description: "Disable erasing const enum declarations in generated code",
},
{
name: "--preserveSymlinks",
description:
"Disable resolving symlinks to their realpath. This correlates to the same flag in node",
},
{
name: "--preserveWatchOutput",
description: "Disable wiping the console in watch mode",
},
{
name: "--pretty",
description:
"Enable color and formatting in output to make compiler errors easier to read",
},
{
name: "--reactNamespace",
description:
"Specify the object invoked for createElement. This only applies when targeting react JSX emit",
args: {
name: "object",
default: "React",
},
},
{
name: "--removeComments",
description: "Disable emitting comments",
},
{
name: "--resolveJsonModule",
description: "Enable importing .json files",
},
{
name: "--rootDir",
description: "Specify the root folder within your source files",
args: {
name: "string",
template: "folders",
},
},
{
name: "--rootDirs",
description:
"Allow multiple folders to be treated as one when resolving modules",
args: {
name: "string",
template: "folders",
isVariadic: true,
},
},
{
name: "--skipDefaultLibCheck",
description:
"Skip type checking .d.ts files that are included with TypeScript",
},
{
name: "--skipLibCheck",
description: "Skip type checking all .d.ts files",
},
{
name: "--sourceMap",
description: "Create source map files for emitted JavaScript files",
},
{
name: "--sourceRoot",
description:
"Specify the root path for debuggers to find the reference source code",
args: {
name: "string",
template: ["filepaths", "folders"],
},
},
{
name: "--strict",
description: "Enable all strict type checking options",
},
{
name: "--strictBindCallApply",
description:
"Check that the arguments for bind, call, and apply methods match the original function",
},
{
name: "--strictFunctionTypes",
description:
"When assigning functions, check to ensure parameters and the return values are subtype-compatible",
},
{
name: "--strictNullChecks",
description: "When type checking, take into account null and undefined",
},
{
name: "--strictPropertyInitialization",
description:
"Check for class properties that are declared but not set in the constructor",
},
{
name: "--stripInternal",
description:
"Disable emitting declarations that have @internal in their JSDoc comments",
},
{
name: "--suppressExcessPropertyErrors",
description:
"Disable reporting of excess property errors during the creation of object literals",
},
{
name: "--suppressImplicitAnyIndexErrors",
description:
"Suppress noImplicitAny errors when indexing objects that lack index signatures",
},
{
name: "--target",
description:
"Set the JavaScript language version for emitted JavaScript and include compatible library declarations",
args: {
default: "ES3",
suggestions: [
"ES3",
"ES5",
"ES6",
"ES2015",
"ES7",
"ES2016",
"ES2017",
"ES2018",
"ES2019",
"ES2020",
"ESNext",
],
},
},
{
name: "--traceResolution",
description: "Log paths used during the moduleResolution process",
},
{
name: "--tsBuildInfoFile",
description:
"Specify the folder for .tsbuildinfo incremental compilation files",
args: {
name: "string",
template: "folders",
},
},
{
name: "--typeRoots",
description:
"Specify multiple folders that act like ./node_modules/@types",
args: {
name: "folders",
template: "folders",
isVariadic: true,
},
},
{
name: "--types",
description:
"Specify type package names to be included without being referenced in a source file",
args: {
name: "package names",
isVariadic: true,
},
},
{
name: "--useDefineForClassFields",
description: "Emit ECMAScript-standard-compliant class fields",
},
{
name: "--useUnknownInCatchVariables",
description: "Default catch clause variables as unknown instead of any",
},
],
args: {
name: "tsc script",
isScript: true,
generators: filepaths({
extensions: ["ts"],
editFileSuggestions: { priority: 76 },
editFolderSuggestions: { priority: 70 },
}),
},
};
export default completionSpec;