@visulima/tsconfig 1.1.23 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,1955 +1,7 @@
1
+ import { Except, TsConfigJson } from 'type-fest';
2
+ export { TsConfigJson } from 'type-fest';
1
3
  import { WriteJsonOptions } from '@visulima/fs';
2
4
 
3
- declare global {
4
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
5
- interface SymbolConstructor {
6
- readonly observable: symbol;
7
- }
8
- }
9
-
10
- /**
11
- Extract all optional keys from the given type.
12
-
13
- This is useful when you want to create a new type that contains different type values for the optional keys only.
14
-
15
- @example
16
- ```
17
- import type {OptionalKeysOf, Except} from 'type-fest';
18
-
19
- interface User {
20
- name: string;
21
- surname: string;
22
-
23
- luckyNumber?: number;
24
- }
25
-
26
- const REMOVE_FIELD = Symbol('remove field symbol');
27
- type UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKeysOf<Entity>> & {
28
- [Key in OptionalKeysOf<Entity>]?: Entity[Key] | typeof REMOVE_FIELD;
29
- };
30
-
31
- const update1: UpdateOperation<User> = {
32
- name: 'Alice'
33
- };
34
-
35
- const update2: UpdateOperation<User> = {
36
- name: 'Bob',
37
- luckyNumber: REMOVE_FIELD
38
- };
39
- ```
40
-
41
- @category Utilities
42
- */
43
- type OptionalKeysOf<BaseType extends object> =
44
- BaseType extends unknown // For distributing `BaseType`
45
- ? (keyof {
46
- [Key in keyof BaseType as BaseType extends Record<Key, BaseType[Key]> ? never : Key]: never
47
- }) & (keyof BaseType) // Intersect with `keyof BaseType` to ensure result of `OptionalKeysOf<BaseType>` is always assignable to `keyof BaseType`
48
- : never; // Should never happen
49
-
50
- /**
51
- Extract all required keys from the given type.
52
-
53
- This is useful when you want to create a new type that contains different type values for the required keys only or use the list of keys for validation purposes, etc...
54
-
55
- @example
56
- ```
57
- import type {RequiredKeysOf} from 'type-fest';
58
-
59
- declare function createValidation<Entity extends object, Key extends RequiredKeysOf<Entity> = RequiredKeysOf<Entity>>(field: Key, validator: (value: Entity[Key]) => boolean): ValidatorFn;
60
-
61
- interface User {
62
- name: string;
63
- surname: string;
64
-
65
- luckyNumber?: number;
66
- }
67
-
68
- const validator1 = createValidation<User>('name', value => value.length < 25);
69
- const validator2 = createValidation<User>('surname', value => value.length < 25);
70
- ```
71
-
72
- @category Utilities
73
- */
74
- type RequiredKeysOf<BaseType extends object> =
75
- BaseType extends unknown // For distributing `BaseType`
76
- ? Exclude<keyof BaseType, OptionalKeysOf<BaseType>>
77
- : never; // Should never happen
78
-
79
- /**
80
- Returns a boolean for whether the given type is `never`.
81
-
82
- @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
83
- @link https://stackoverflow.com/a/53984913/10292952
84
- @link https://www.zhenghao.io/posts/ts-never
85
-
86
- Useful in type utilities, such as checking if something does not occur.
87
-
88
- @example
89
- ```
90
- import type {IsNever, And} from 'type-fest';
91
-
92
- // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
93
- type AreStringsEqual<A extends string, B extends string> =
94
- And<
95
- IsNever<Exclude<A, B>> extends true ? true : false,
96
- IsNever<Exclude<B, A>> extends true ? true : false
97
- >;
98
-
99
- type EndIfEqual<I extends string, O extends string> =
100
- AreStringsEqual<I, O> extends true
101
- ? never
102
- : void;
103
-
104
- function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
105
- if (input === output) {
106
- process.exit(0);
107
- }
108
- }
109
-
110
- endIfEqual('abc', 'abc');
111
- //=> never
112
-
113
- endIfEqual('abc', '123');
114
- //=> void
115
- ```
116
-
117
- @category Type Guard
118
- @category Utilities
119
- */
120
- type IsNever<T> = [T] extends [never] ? true : false;
121
-
122
- /**
123
- An if-else-like type that resolves depending on whether the given type is `never`.
124
-
125
- @see {@link IsNever}
126
-
127
- @example
128
- ```
129
- import type {IfNever} from 'type-fest';
130
-
131
- type ShouldBeTrue = IfNever<never>;
132
- //=> true
133
-
134
- type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
135
- //=> 'bar'
136
- ```
137
-
138
- @category Type Guard
139
- @category Utilities
140
- */
141
- type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (
142
- IsNever<T> extends true ? TypeIfNever : TypeIfNotNever
143
- );
144
-
145
- // Can eventually be replaced with the built-in once this library supports
146
- // TS5.4+ only. Tracked in https://github.com/sindresorhus/type-fest/issues/848
147
- type NoInfer<T> = T extends infer U ? U : never;
148
-
149
- /**
150
- Returns a boolean for whether the given type is `any`.
151
-
152
- @link https://stackoverflow.com/a/49928360/1490091
153
-
154
- Useful in type utilities, such as disallowing `any`s to be passed to a function.
155
-
156
- @example
157
- ```
158
- import type {IsAny} from 'type-fest';
159
-
160
- const typedObject = {a: 1, b: 2} as const;
161
- const anyObject: any = {a: 1, b: 2};
162
-
163
- function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(obj: O, key: K) {
164
- return obj[key];
165
- }
166
-
167
- const typedA = get(typedObject, 'a');
168
- //=> 1
169
-
170
- const anyA = get(anyObject, 'a');
171
- //=> any
172
- ```
173
-
174
- @category Type Guard
175
- @category Utilities
176
- */
177
- type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
178
-
179
- /**
180
- Returns a boolean for whether the two given types are equal.
181
-
182
- @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
183
- @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
184
-
185
- Use-cases:
186
- - If you want to make a conditional branch based on the result of a comparison of two types.
187
-
188
- @example
189
- ```
190
- import type {IsEqual} from 'type-fest';
191
-
192
- // This type returns a boolean for whether the given array includes the given item.
193
- // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
194
- type Includes<Value extends readonly any[], Item> =
195
- Value extends readonly [Value[0], ...infer rest]
196
- ? IsEqual<Value[0], Item> extends true
197
- ? true
198
- : Includes<rest, Item>
199
- : false;
200
- ```
201
-
202
- @category Type Guard
203
- @category Utilities
204
- */
205
- type IsEqual<A, B> =
206
- (<G>() => G extends A & G | G ? 1 : 2) extends
207
- (<G>() => G extends B & G | G ? 1 : 2)
208
- ? true
209
- : false;
210
-
211
- /**
212
- Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
213
-
214
- @example
215
- ```
216
- import type {Simplify} from 'type-fest';
217
-
218
- type PositionProps = {
219
- top: number;
220
- left: number;
221
- };
222
-
223
- type SizeProps = {
224
- width: number;
225
- height: number;
226
- };
227
-
228
- // In your editor, hovering over `Props` will show a flattened object with all the properties.
229
- type Props = Simplify<PositionProps & SizeProps>;
230
- ```
231
-
232
- Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record<string, unknown>`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface.
233
-
234
- If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify<SomeInterface> = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify<SomeInterface>` if you can't re-declare the `value`.
235
-
236
- @example
237
- ```
238
- import type {Simplify} from 'type-fest';
239
-
240
- interface SomeInterface {
241
- foo: number;
242
- bar?: string;
243
- baz: number | undefined;
244
- }
245
-
246
- type SomeType = {
247
- foo: number;
248
- bar?: string;
249
- baz: number | undefined;
250
- };
251
-
252
- const literal = {foo: 123, bar: 'hello', baz: 456};
253
- const someType: SomeType = literal;
254
- const someInterface: SomeInterface = literal;
255
-
256
- function fn(object: Record<string, unknown>): void {}
257
-
258
- fn(literal); // Good: literal object type is sealed
259
- fn(someType); // Good: type is sealed
260
- fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
261
- fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
262
- ```
263
-
264
- @link https://github.com/microsoft/TypeScript/issues/15300
265
- @see SimplifyDeep
266
- @category Object
267
- */
268
- type Simplify<T> = {[KeyType in keyof T]: T[KeyType]} & {};
269
-
270
- /**
271
- Omit any index signatures from the given object type, leaving only explicitly defined properties.
272
-
273
- This is the counterpart of `PickIndexSignature`.
274
-
275
- Use-cases:
276
- - Remove overly permissive signatures from third-party types.
277
-
278
- This type was taken from this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747).
279
-
280
- It relies on the fact that an empty object (`{}`) is assignable to an object with just an index signature, like `Record<string, unknown>`, but not to an object with explicitly defined keys, like `Record<'foo' | 'bar', unknown>`.
281
-
282
- (The actual value type, `unknown`, is irrelevant and could be any type. Only the key type matters.)
283
-
284
- ```
285
- const indexed: Record<string, unknown> = {}; // Allowed
286
-
287
- const keyed: Record<'foo', unknown> = {}; // Error
288
- // => TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
289
- ```
290
-
291
- Instead of causing a type error like the above, you can also use a [conditional type](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html) to test whether a type is assignable to another:
292
-
293
- ```
294
- type Indexed = {} extends Record<string, unknown>
295
- ? '✅ `{}` is assignable to `Record<string, unknown>`'
296
- : '❌ `{}` is NOT assignable to `Record<string, unknown>`';
297
- // => '✅ `{}` is assignable to `Record<string, unknown>`'
298
-
299
- type Keyed = {} extends Record<'foo' | 'bar', unknown>
300
- ? "✅ `{}` is assignable to `Record<'foo' | 'bar', unknown>`"
301
- : "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`";
302
- // => "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`"
303
- ```
304
-
305
- Using a [mapped type](https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#further-exploration), you can then check for each `KeyType` of `ObjectType`...
306
-
307
- ```
308
- import type {OmitIndexSignature} from 'type-fest';
309
-
310
- type OmitIndexSignature<ObjectType> = {
311
- [KeyType in keyof ObjectType // Map each key of `ObjectType`...
312
- ]: ObjectType[KeyType]; // ...to its original value, i.e. `OmitIndexSignature<Foo> == Foo`.
313
- };
314
- ```
315
-
316
- ...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record<KeyType, unknown>`)...
317
-
318
- ```
319
- import type {OmitIndexSignature} from 'type-fest';
320
-
321
- type OmitIndexSignature<ObjectType> = {
322
- [KeyType in keyof ObjectType
323
- // Is `{}` assignable to `Record<KeyType, unknown>`?
324
- as {} extends Record<KeyType, unknown>
325
- ? ... // ✅ `{}` is assignable to `Record<KeyType, unknown>`
326
- : ... // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`
327
- ]: ObjectType[KeyType];
328
- };
329
- ```
330
-
331
- If `{}` is assignable, it means that `KeyType` is an index signature and we want to remove it. If it is not assignable, `KeyType` is a "real" key and we want to keep it.
332
-
333
- @example
334
- ```
335
- import type {OmitIndexSignature} from 'type-fest';
336
-
337
- interface Example {
338
- // These index signatures will be removed.
339
- [x: string]: any
340
- [x: number]: any
341
- [x: symbol]: any
342
- [x: `head-${string}`]: string
343
- [x: `${string}-tail`]: string
344
- [x: `head-${string}-tail`]: string
345
- [x: `${bigint}`]: string
346
- [x: `embedded-${number}`]: string
347
-
348
- // These explicitly defined keys will remain.
349
- foo: 'bar';
350
- qux?: 'baz';
351
- }
352
-
353
- type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
354
- // => { foo: 'bar'; qux?: 'baz' | undefined; }
355
- ```
356
-
357
- @see PickIndexSignature
358
- @category Object
359
- */
360
- type OmitIndexSignature<ObjectType> = {
361
- [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown>
362
- ? never
363
- : KeyType]: ObjectType[KeyType];
364
- };
365
-
366
- /**
367
- Pick only index signatures from the given object type, leaving out all explicitly defined properties.
368
-
369
- This is the counterpart of `OmitIndexSignature`.
370
-
371
- @example
372
- ```
373
- import type {PickIndexSignature} from 'type-fest';
374
-
375
- declare const symbolKey: unique symbol;
376
-
377
- type Example = {
378
- // These index signatures will remain.
379
- [x: string]: unknown;
380
- [x: number]: unknown;
381
- [x: symbol]: unknown;
382
- [x: `head-${string}`]: string;
383
- [x: `${string}-tail`]: string;
384
- [x: `head-${string}-tail`]: string;
385
- [x: `${bigint}`]: string;
386
- [x: `embedded-${number}`]: string;
387
-
388
- // These explicitly defined keys will be removed.
389
- ['kebab-case-key']: string;
390
- [symbolKey]: string;
391
- foo: 'bar';
392
- qux?: 'baz';
393
- };
394
-
395
- type ExampleIndexSignature = PickIndexSignature<Example>;
396
- // {
397
- // [x: string]: unknown;
398
- // [x: number]: unknown;
399
- // [x: symbol]: unknown;
400
- // [x: `head-${string}`]: string;
401
- // [x: `${string}-tail`]: string;
402
- // [x: `head-${string}-tail`]: string;
403
- // [x: `${bigint}`]: string;
404
- // [x: `embedded-${number}`]: string;
405
- // }
406
- ```
407
-
408
- @see OmitIndexSignature
409
- @category Object
410
- */
411
- type PickIndexSignature<ObjectType> = {
412
- [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown>
413
- ? KeyType
414
- : never]: ObjectType[KeyType];
415
- };
416
-
417
- // Merges two objects without worrying about index signatures.
418
- type SimpleMerge<Destination, Source> = {
419
- [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key];
420
- } & Source;
421
-
422
- /**
423
- Merge two types into a new type. Keys of the second type overrides keys of the first type.
424
-
425
- @example
426
- ```
427
- import type {Merge} from 'type-fest';
428
-
429
- interface Foo {
430
- [x: string]: unknown;
431
- [x: number]: unknown;
432
- foo: string;
433
- bar: symbol;
434
- }
435
-
436
- type Bar = {
437
- [x: number]: number;
438
- [x: symbol]: unknown;
439
- bar: Date;
440
- baz: boolean;
441
- };
442
-
443
- export type FooBar = Merge<Foo, Bar>;
444
- // => {
445
- // [x: string]: unknown;
446
- // [x: number]: number;
447
- // [x: symbol]: unknown;
448
- // foo: string;
449
- // bar: Date;
450
- // baz: boolean;
451
- // }
452
- ```
453
-
454
- @category Object
455
- */
456
- type Merge<Destination, Source> =
457
- Simplify<
458
- SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>>
459
- & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>
460
- >;
461
-
462
- /**
463
- An if-else-like type that resolves depending on whether the given type is `any`.
464
-
465
- @see {@link IsAny}
466
-
467
- @example
468
- ```
469
- import type {IfAny} from 'type-fest';
470
-
471
- type ShouldBeTrue = IfAny<any>;
472
- //=> true
473
-
474
- type ShouldBeBar = IfAny<'not any', 'foo', 'bar'>;
475
- //=> 'bar'
476
- ```
477
-
478
- @category Type Guard
479
- @category Utilities
480
- */
481
- type IfAny<T, TypeIfAny = true, TypeIfNotAny = false> = (
482
- IsAny<T> extends true ? TypeIfAny : TypeIfNotAny
483
- );
484
-
485
- /**
486
- Merges user specified options with default options.
487
-
488
- @example
489
- ```
490
- type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
491
- type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
492
- type SpecifiedOptions = {leavesOnly: true};
493
-
494
- type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
495
- //=> {maxRecursionDepth: 10; leavesOnly: true}
496
- ```
497
-
498
- @example
499
- ```
500
- // Complains if default values are not provided for optional options
501
-
502
- type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
503
- type DefaultPathsOptions = {maxRecursionDepth: 10};
504
- type SpecifiedOptions = {};
505
-
506
- type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
507
- // ~~~~~~~~~~~~~~~~~~~
508
- // Property 'leavesOnly' is missing in type 'DefaultPathsOptions' but required in type '{ maxRecursionDepth: number; leavesOnly: boolean; }'.
509
- ```
510
-
511
- @example
512
- ```
513
- // Complains if an option's default type does not conform to the expected type
514
-
515
- type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
516
- type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: 'no'};
517
- type SpecifiedOptions = {};
518
-
519
- type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
520
- // ~~~~~~~~~~~~~~~~~~~
521
- // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
522
- ```
523
-
524
- @example
525
- ```
526
- // Complains if an option's specified type does not conform to the expected type
527
-
528
- type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
529
- type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
530
- type SpecifiedOptions = {leavesOnly: 'yes'};
531
-
532
- type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
533
- // ~~~~~~~~~~~~~~~~
534
- // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
535
- ```
536
- */
537
- type ApplyDefaultOptions<
538
- Options extends object,
539
- Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>,
540
- SpecifiedOptions extends Options,
541
- > =
542
- IfAny<SpecifiedOptions, Defaults,
543
- IfNever<SpecifiedOptions, Defaults,
544
- Simplify<Merge<Defaults, {
545
- [Key in keyof SpecifiedOptions
546
- as Key extends OptionalKeysOf<Options>
547
- ? Extract<SpecifiedOptions[Key], undefined> extends never
548
- ? Key
549
- : never
550
- : Key
551
- ]: SpecifiedOptions[Key]
552
- }> & Required<Options>> // `& Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
553
- >>;
554
-
555
- /**
556
- Filter out keys from an object.
557
-
558
- Returns `never` if `Exclude` is strictly equal to `Key`.
559
- Returns `never` if `Key` extends `Exclude`.
560
- Returns `Key` otherwise.
561
-
562
- @example
563
- ```
564
- type Filtered = Filter<'foo', 'foo'>;
565
- //=> never
566
- ```
567
-
568
- @example
569
- ```
570
- type Filtered = Filter<'bar', string>;
571
- //=> never
572
- ```
573
-
574
- @example
575
- ```
576
- type Filtered = Filter<'bar', 'foo'>;
577
- //=> 'bar'
578
- ```
579
-
580
- @see {Except}
581
- */
582
- type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
583
-
584
- type ExceptOptions = {
585
- /**
586
- Disallow assigning non-specified properties.
587
-
588
- Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
589
-
590
- @default false
591
- */
592
- requireExactProps?: boolean;
593
- };
594
-
595
- type DefaultExceptOptions = {
596
- requireExactProps: false;
597
- };
598
-
599
- /**
600
- Create a type from an object type without certain keys.
601
-
602
- We recommend setting the `requireExactProps` option to `true`.
603
-
604
- 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.
605
-
606
- 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)).
607
-
608
- @example
609
- ```
610
- import type {Except} from 'type-fest';
611
-
612
- type Foo = {
613
- a: number;
614
- b: string;
615
- };
616
-
617
- type FooWithoutA = Except<Foo, 'a'>;
618
- //=> {b: string}
619
-
620
- const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
621
- //=> errors: 'a' does not exist in type '{ b: string; }'
622
-
623
- type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
624
- //=> {a: number} & Partial<Record<"b", never>>
625
-
626
- const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
627
- //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
628
-
629
- // The `Omit` utility type doesn't work when omitting specific keys from objects containing index signatures.
630
-
631
- // Consider the following example:
632
-
633
- type UserData = {
634
- [metadata: string]: string;
635
- email: string;
636
- name: string;
637
- role: 'admin' | 'user';
638
- };
639
-
640
- // `Omit` clearly doesn't behave as expected in this case:
641
- type PostPayload = Omit<UserData, 'email'>;
642
- //=> type PostPayload = { [x: string]: string; [x: number]: string; }
643
-
644
- // In situations like this, `Except` works better.
645
- // It simply removes the `email` key while preserving all the other keys.
646
- type PostPayload = Except<UserData, 'email'>;
647
- //=> type PostPayload = { [x: string]: string; name: string; role: 'admin' | 'user'; }
648
- ```
649
-
650
- @category Object
651
- */
652
- type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> =
653
- _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
654
-
655
- type _Except<ObjectType, KeysType extends keyof ObjectType, Options extends Required<ExceptOptions>> = {
656
- [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
657
- } & (Options['requireExactProps'] extends true
658
- ? Partial<Record<KeysType, never>>
659
- : {});
660
-
661
- declare namespace TsConfigJson {
662
- namespace CompilerOptions {
663
- export type JSX =
664
- | 'preserve'
665
- | 'react'
666
- | 'react-jsx'
667
- | 'react-jsxdev'
668
- | 'react-native';
669
-
670
- export type Module =
671
- | 'CommonJS'
672
- | 'AMD'
673
- | 'System'
674
- | 'UMD'
675
- | 'ES6'
676
- | 'ES2015'
677
- | 'ES2020'
678
- | 'ES2022'
679
- | 'ESNext'
680
- | 'Node16'
681
- | 'Node18'
682
- | 'NodeNext'
683
- | 'Preserve'
684
- | 'None'
685
- // Lowercase alternatives
686
- | 'commonjs'
687
- | 'amd'
688
- | 'system'
689
- | 'umd'
690
- | 'es6'
691
- | 'es2015'
692
- | 'es2020'
693
- | 'es2022'
694
- | 'esnext'
695
- | 'node16'
696
- | 'node18'
697
- | 'nodenext'
698
- | 'preserve'
699
- | 'none';
700
-
701
- export type NewLine =
702
- | 'CRLF'
703
- | 'LF'
704
- // Lowercase alternatives
705
- | 'crlf'
706
- | 'lf';
707
-
708
- export type Target =
709
- | 'ES3'
710
- | 'ES5'
711
- | 'ES6'
712
- | 'ES2015'
713
- | 'ES2016'
714
- | 'ES2017'
715
- | 'ES2018'
716
- | 'ES2019'
717
- | 'ES2020'
718
- | 'ES2021'
719
- | 'ES2022'
720
- | 'ES2023'
721
- | 'ES2024'
722
- | 'ESNext'
723
- // Lowercase alternatives
724
- | 'es3'
725
- | 'es5'
726
- | 'es6'
727
- | 'es2015'
728
- | 'es2016'
729
- | 'es2017'
730
- | 'es2018'
731
- | 'es2019'
732
- | 'es2020'
733
- | 'es2021'
734
- | 'es2022'
735
- | 'es2023'
736
- | 'es2024'
737
- | 'esnext';
738
-
739
- // eslint-disable-next-line unicorn/prevent-abbreviations
740
- export type Lib =
741
- | 'ES5'
742
- | 'ES6'
743
- | 'ES7'
744
- | 'ES2015'
745
- | 'ES2015.Collection'
746
- | 'ES2015.Core'
747
- | 'ES2015.Generator'
748
- | 'ES2015.Iterable'
749
- | 'ES2015.Promise'
750
- | 'ES2015.Proxy'
751
- | 'ES2015.Reflect'
752
- | 'ES2015.Symbol.WellKnown'
753
- | 'ES2015.Symbol'
754
- | 'ES2016'
755
- | 'ES2016.Array.Include'
756
- | 'ES2017'
757
- | 'ES2017.ArrayBuffer'
758
- | 'ES2017.Date'
759
- | 'ES2017.Intl'
760
- | 'ES2017.Object'
761
- | 'ES2017.SharedMemory'
762
- | 'ES2017.String'
763
- | 'ES2017.TypedArrays'
764
- | 'ES2018'
765
- | 'ES2018.AsyncGenerator'
766
- | 'ES2018.AsyncIterable'
767
- | 'ES2018.Intl'
768
- | 'ES2018.Promise'
769
- | 'ES2018.Regexp'
770
- | 'ES2019'
771
- | 'ES2019.Array'
772
- | 'ES2019.Object'
773
- | 'ES2019.String'
774
- | 'ES2019.Symbol'
775
- | 'ES2020'
776
- | 'ES2020.BigInt'
777
- | 'ES2020.Promise'
778
- | 'ES2020.String'
779
- | 'ES2020.Symbol.WellKnown'
780
- | 'ES2020.SharedMemory'
781
- | 'ES2020.Intl'
782
- | 'ES2021'
783
- | 'ES2021.Intl'
784
- | 'ES2021.Promise'
785
- | 'ES2021.String'
786
- | 'ES2021.WeakRef'
787
- | 'ES2022'
788
- | 'ES2022.Array'
789
- | 'ES2022.Error'
790
- | 'ES2022.Intl'
791
- | 'ES2022.Object'
792
- | 'ES2022.RegExp'
793
- | 'ES2022.String'
794
- | 'ES2023'
795
- | 'ES2023.Array'
796
- | 'ES2023.Collection'
797
- | 'ES2023.Intl'
798
- | 'ES2024'
799
- | 'ES2024.ArrayBuffer'
800
- | 'ES2024.Collection'
801
- | 'ES2024.Object'
802
- | 'ES2024.Promise'
803
- | 'ES2024.Regexp'
804
- | 'ES2024.SharedMemory'
805
- | 'ES2024.String'
806
- | 'ESNext'
807
- | 'ESNext.Array'
808
- | 'ESNext.AsyncIterable'
809
- | 'ESNext.BigInt'
810
- | 'ESNext.Collection'
811
- | 'ESNext.Decorators'
812
- | 'ESNext.Disposable'
813
- | 'ESNext.Intl'
814
- | 'ESNext.Iterator'
815
- | 'ESNext.Promise'
816
- | 'ESNext.String'
817
- | 'ESNext.Symbol'
818
- | 'ESNext.WeakRef'
819
- | 'DOM'
820
- | 'DOM.Iterable'
821
- | 'ScriptHost'
822
- | 'WebWorker'
823
- | 'WebWorker.AsyncIterable'
824
- | 'WebWorker.ImportScripts'
825
- | 'WebWorker.Iterable'
826
- // Lowercase alternatives
827
- | 'es5'
828
- | 'es6'
829
- | 'es7'
830
- | 'es2015'
831
- | 'es2015.collection'
832
- | 'es2015.core'
833
- | 'es2015.generator'
834
- | 'es2015.iterable'
835
- | 'es2015.promise'
836
- | 'es2015.proxy'
837
- | 'es2015.reflect'
838
- | 'es2015.symbol.wellknown'
839
- | 'es2015.symbol'
840
- | 'es2016'
841
- | 'es2016.array.include'
842
- | 'es2017'
843
- | 'es2017.arraybuffer'
844
- | 'es2017.date'
845
- | 'es2017.intl'
846
- | 'es2017.object'
847
- | 'es2017.sharedmemory'
848
- | 'es2017.string'
849
- | 'es2017.typedarrays'
850
- | 'es2018'
851
- | 'es2018.asyncgenerator'
852
- | 'es2018.asynciterable'
853
- | 'es2018.intl'
854
- | 'es2018.promise'
855
- | 'es2018.regexp'
856
- | 'es2019'
857
- | 'es2019.array'
858
- | 'es2019.object'
859
- | 'es2019.string'
860
- | 'es2019.symbol'
861
- | 'es2020'
862
- | 'es2020.bigint'
863
- | 'es2020.promise'
864
- | 'es2020.string'
865
- | 'es2020.symbol.wellknown'
866
- | 'es2020.sharedmemory'
867
- | 'es2020.intl'
868
- | 'es2021'
869
- | 'es2021.intl'
870
- | 'es2021.promise'
871
- | 'es2021.string'
872
- | 'es2021.weakref'
873
- | 'es2022'
874
- | 'es2022.array'
875
- | 'es2022.error'
876
- | 'es2022.intl'
877
- | 'es2022.object'
878
- | 'es2022.regexp'
879
- | 'es2022.string'
880
- | 'es2023'
881
- | 'es2023.array'
882
- | 'es2023.collection'
883
- | 'es2023.intl'
884
- | 'es2024'
885
- | 'es2024.arraybuffer'
886
- | 'es2024.collection'
887
- | 'es2024.object'
888
- | 'es2024.promise'
889
- | 'es2024.regexp'
890
- | 'es2024.sharedmemory'
891
- | 'es2024.string'
892
- | 'esnext'
893
- | 'esnext.array'
894
- | 'esnext.asynciterable'
895
- | 'esnext.bigint'
896
- | 'esnext.collection'
897
- | 'esnext.decorators'
898
- | 'esnext.disposable'
899
- | 'esnext.intl'
900
- | 'esnext.iterator'
901
- | 'esnext.promise'
902
- | 'esnext.string'
903
- | 'esnext.symbol'
904
- | 'esnext.weakref'
905
- | 'dom'
906
- | 'dom.iterable'
907
- | 'scripthost'
908
- | 'webworker'
909
- | 'webworker.asynciterable'
910
- | 'webworker.importscripts'
911
- | 'webworker.iterable';
912
-
913
- export type Plugin = {
914
- /**
915
- Plugin name.
916
- */
917
- name: string;
918
- };
919
-
920
- export type ImportsNotUsedAsValues =
921
- | 'remove'
922
- | 'preserve'
923
- | 'error';
924
-
925
- export type FallbackPolling =
926
- | 'fixedPollingInterval'
927
- | 'priorityPollingInterval'
928
- | 'dynamicPriorityPolling'
929
- | 'fixedInterval'
930
- | 'priorityInterval'
931
- | 'dynamicPriority'
932
- | 'fixedChunkSize';
933
-
934
- export type WatchDirectory =
935
- | 'useFsEvents'
936
- | 'fixedPollingInterval'
937
- | 'dynamicPriorityPolling'
938
- | 'fixedChunkSizePolling';
939
-
940
- export type WatchFile =
941
- | 'fixedPollingInterval'
942
- | 'priorityPollingInterval'
943
- | 'dynamicPriorityPolling'
944
- | 'useFsEvents'
945
- | 'useFsEventsOnParentDirectory'
946
- | 'fixedChunkSizePolling';
947
-
948
- export type ModuleResolution =
949
- | 'classic'
950
- | 'node'
951
- | 'node10'
952
- | 'node16'
953
- | 'nodenext'
954
- | 'bundler'
955
- // Pascal-cased alternatives
956
- | 'Classic'
957
- | 'Node'
958
- | 'Node10'
959
- | 'Node16'
960
- | 'NodeNext'
961
- | 'Bundler';
962
-
963
- export type ModuleDetection =
964
- | 'auto'
965
- | 'legacy'
966
- | 'force';
967
-
968
- export type IgnoreDeprecations = '5.0';
969
- }
970
-
971
- export type CompilerOptions = {
972
- /**
973
- The character set of the input files.
974
-
975
- @default 'utf8'
976
- @deprecated This option will be removed in TypeScript 5.5.
977
- */
978
- charset?: string;
979
-
980
- /**
981
- Enables building for project references.
982
-
983
- @default true
984
- */
985
- composite?: boolean;
986
-
987
- /**
988
- Generates corresponding d.ts files.
989
-
990
- @default false
991
- */
992
- declaration?: boolean;
993
-
994
- /**
995
- Specify output directory for generated declaration files.
996
- */
997
- declarationDir?: string;
998
-
999
- /**
1000
- Show diagnostic information.
1001
-
1002
- @default false
1003
- */
1004
- diagnostics?: boolean;
1005
-
1006
- /**
1007
- Reduce the number of projects loaded automatically by TypeScript.
1008
-
1009
- @default false
1010
- */
1011
- disableReferencedProjectLoad?: boolean;
1012
-
1013
- /**
1014
- Enforces using indexed accessors for keys declared using an indexed type.
1015
-
1016
- @default false
1017
- */
1018
- noPropertyAccessFromIndexSignature?: boolean;
1019
-
1020
- /**
1021
- Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.
1022
-
1023
- @default false
1024
- */
1025
- emitBOM?: boolean;
1026
-
1027
- /**
1028
- Only emit `.d.ts` declaration files.
1029
-
1030
- @default false
1031
- */
1032
- emitDeclarationOnly?: boolean;
1033
-
1034
- /**
1035
- Differentiate between undefined and not present when type checking.
1036
-
1037
- @default false
1038
- */
1039
- exactOptionalPropertyTypes?: boolean;
1040
-
1041
- /**
1042
- Enable incremental compilation.
1043
-
1044
- @default `composite`
1045
- */
1046
- incremental?: boolean;
1047
-
1048
- /**
1049
- Specify file to store incremental compilation information.
1050
-
1051
- @default '.tsbuildinfo'
1052
- */
1053
- tsBuildInfoFile?: string;
1054
-
1055
- /**
1056
- Emit a single file with source maps instead of having a separate file.
1057
-
1058
- @default false
1059
- */
1060
- inlineSourceMap?: boolean;
1061
-
1062
- /**
1063
- Emit the source alongside the sourcemaps within a single file.
1064
-
1065
- Requires `--inlineSourceMap` to be set.
1066
-
1067
- @default false
1068
- */
1069
- inlineSources?: boolean;
1070
-
1071
- /**
1072
- Specify what JSX code is generated.
1073
-
1074
- @default 'preserve'
1075
- */
1076
- jsx?: CompilerOptions.JSX;
1077
-
1078
- /**
1079
- Specifies the object invoked for `createElement` and `__spread` when targeting `'react'` JSX emit.
1080
-
1081
- @default 'React'
1082
- */
1083
- reactNamespace?: string;
1084
-
1085
- /**
1086
- Specify the JSX factory function to use when targeting React JSX emit, e.g. `React.createElement` or `h`.
1087
-
1088
- @default 'React.createElement'
1089
- */
1090
- jsxFactory?: string;
1091
-
1092
- /**
1093
- Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'.
1094
-
1095
- @default 'React.Fragment'
1096
- */
1097
- jsxFragmentFactory?: string;
1098
-
1099
- /**
1100
- Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.
1101
-
1102
- @default 'react'
1103
- */
1104
- jsxImportSource?: string;
1105
-
1106
- /**
1107
- Print names of files part of the compilation.
1108
-
1109
- @default false
1110
- */
1111
- listFiles?: boolean;
1112
-
1113
- /**
1114
- Specifies the location where debugger should locate map files instead of generated locations.
1115
- */
1116
- mapRoot?: string;
1117
-
1118
- /**
1119
- 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.
1120
-
1121
- @default ['ES3', 'ES5'].includes(target) ? 'CommonJS' : 'ES6'
1122
- */
1123
- module?: CompilerOptions.Module;
1124
-
1125
- /**
1126
- Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6).
1127
-
1128
- @default ['AMD', 'System', 'ES6'].includes(module) ? 'classic' : 'node'
1129
- */
1130
- moduleResolution?: CompilerOptions.ModuleResolution;
1131
-
1132
- /**
1133
- Specifies the end of line sequence to be used when emitting files: 'crlf' (Windows) or 'lf' (Unix).
1134
-
1135
- @default 'LF'
1136
- */
1137
- newLine?: CompilerOptions.NewLine;
1138
-
1139
- /**
1140
- Disable full type checking (only critical parse and emit errors will be reported).
1141
-
1142
- @default false
1143
- */
1144
- noCheck?: boolean;
1145
-
1146
- /**
1147
- Do not emit output.
1148
-
1149
- @default false
1150
- */
1151
- noEmit?: boolean;
1152
-
1153
- /**
1154
- Do not generate custom helper functions like `__extends` in compiled output.
1155
-
1156
- @default false
1157
- */
1158
- noEmitHelpers?: boolean;
1159
-
1160
- /**
1161
- Do not emit outputs if any type checking errors were reported.
1162
-
1163
- @default false
1164
- */
1165
- noEmitOnError?: boolean;
1166
-
1167
- /**
1168
- Warn on expressions and declarations with an implied 'any' type.
1169
-
1170
- @default false
1171
- */
1172
- noImplicitAny?: boolean;
1173
-
1174
- /**
1175
- Raise error on 'this' expressions with an implied any type.
1176
-
1177
- @default false
1178
- */
1179
- noImplicitThis?: boolean;
1180
-
1181
- /**
1182
- Report errors on unused locals.
1183
-
1184
- @default false
1185
- */
1186
- noUnusedLocals?: boolean;
1187
-
1188
- /**
1189
- Report errors on unused parameters.
1190
-
1191
- @default false
1192
- */
1193
- noUnusedParameters?: boolean;
1194
-
1195
- /**
1196
- Do not include the default library file (lib.d.ts).
1197
-
1198
- @default false
1199
- */
1200
- noLib?: boolean;
1201
-
1202
- /**
1203
- Do not add triple-slash references or module import targets to the list of compiled files.
1204
-
1205
- @default false
1206
- */
1207
- noResolve?: boolean;
1208
-
1209
- /**
1210
- Disable strict checking of generic signatures in function types.
1211
-
1212
- @default false
1213
- @deprecated This option will be removed in TypeScript 5.5.
1214
- */
1215
- noStrictGenericChecks?: boolean;
1216
-
1217
- /**
1218
- @deprecated use `skipLibCheck` instead.
1219
- */
1220
- skipDefaultLibCheck?: boolean;
1221
-
1222
- /**
1223
- Skip type checking of declaration files.
1224
-
1225
- @default false
1226
- */
1227
- skipLibCheck?: boolean;
1228
-
1229
- /**
1230
- Concatenate and emit output to single file.
1231
- */
1232
- outFile?: string;
1233
-
1234
- /**
1235
- Redirect output structure to the directory.
1236
- */
1237
- outDir?: string;
1238
-
1239
- /**
1240
- Do not erase const enum declarations in generated code.
1241
-
1242
- @default false
1243
- */
1244
- preserveConstEnums?: boolean;
1245
-
1246
- /**
1247
- Do not resolve symlinks to their real path; treat a symlinked file like a real one.
1248
-
1249
- @default false
1250
- */
1251
- preserveSymlinks?: boolean;
1252
-
1253
- /**
1254
- Keep outdated console output in watch mode instead of clearing the screen.
1255
-
1256
- @default false
1257
- */
1258
- preserveWatchOutput?: boolean;
1259
-
1260
- /**
1261
- Stylize errors and messages using color and context (experimental).
1262
-
1263
- @default true // Unless piping to another program or redirecting output to a file.
1264
- */
1265
- pretty?: boolean;
1266
-
1267
- /**
1268
- Do not emit comments to output.
1269
-
1270
- @default false
1271
- */
1272
- removeComments?: boolean;
1273
-
1274
- /**
1275
- Specifies the root directory of input files.
1276
-
1277
- Use to control the output directory structure with `--outDir`.
1278
- */
1279
- rootDir?: string;
1280
-
1281
- /**
1282
- Unconditionally emit imports for unresolved files.
1283
-
1284
- @default false
1285
- */
1286
- isolatedModules?: boolean;
1287
-
1288
- /**
1289
- Require sufficient annotation on exports so other tools can trivially generate declaration files.
1290
-
1291
- @default false
1292
- */
1293
- isolatedDeclarations?: boolean;
1294
-
1295
- /**
1296
- Generates corresponding '.map' file.
1297
-
1298
- @default false
1299
- */
1300
- sourceMap?: boolean;
1301
-
1302
- /**
1303
- Specifies the location where debugger should locate TypeScript files instead of source locations.
1304
- */
1305
- sourceRoot?: string;
1306
-
1307
- /**
1308
- Suppress excess property checks for object literals.
1309
-
1310
- @default false
1311
- @deprecated This option will be removed in TypeScript 5.5.
1312
- */
1313
- suppressExcessPropertyErrors?: boolean;
1314
-
1315
- /**
1316
- Suppress noImplicitAny errors for indexing objects lacking index signatures.
1317
-
1318
- @default false
1319
- @deprecated This option will be removed in TypeScript 5.5.
1320
- */
1321
- suppressImplicitAnyIndexErrors?: boolean;
1322
-
1323
-
1324
-
1325
- /**
1326
- Specify ECMAScript target version.
1327
-
1328
- @default 'es3'
1329
- */
1330
- target?: CompilerOptions.Target;
1331
-
1332
- /**
1333
- Default catch clause variables as `unknown` instead of `any`.
1334
-
1335
- @default false
1336
- */
1337
- useUnknownInCatchVariables?: boolean;
1338
-
1339
- /**
1340
- Watch input files.
1341
-
1342
- @default false
1343
- @deprecated Use watchOptions instead.
1344
- */
1345
- watch?: boolean;
1346
-
1347
- /**
1348
- Specify the polling strategy to use when the system runs out of or doesn't support native file watchers.
1349
-
1350
- @deprecated Use watchOptions.fallbackPolling instead.
1351
- */
1352
- fallbackPolling?: CompilerOptions.FallbackPolling;
1353
-
1354
- /**
1355
- Specify the strategy for watching directories under systems that lack recursive file-watching functionality.
1356
-
1357
- @default 'useFsEvents'
1358
- @deprecated Use watchOptions.watchDirectory instead.
1359
- */
1360
- watchDirectory?: CompilerOptions.WatchDirectory;
1361
-
1362
- /**
1363
- Specify the strategy for watching individual files.
1364
-
1365
- @default 'useFsEvents'
1366
- @deprecated Use watchOptions.watchFile instead.
1367
- */
1368
- watchFile?: CompilerOptions.WatchFile;
1369
-
1370
- /**
1371
- Enables experimental support for ES7 decorators.
1372
-
1373
- @default false
1374
- */
1375
- experimentalDecorators?: boolean;
1376
-
1377
- /**
1378
- Emit design-type metadata for decorated declarations in source.
1379
-
1380
- @default false
1381
- */
1382
- emitDecoratorMetadata?: boolean;
1383
-
1384
- /**
1385
- Do not report errors on unused labels.
1386
-
1387
- @default false
1388
- */
1389
- allowUnusedLabels?: boolean;
1390
-
1391
- /**
1392
- Report error when not all code paths in function return a value.
1393
-
1394
- @default false
1395
- */
1396
- noImplicitReturns?: boolean;
1397
-
1398
- /**
1399
- Add `undefined` to a type when accessed using an index.
1400
-
1401
- @default false
1402
- */
1403
- noUncheckedIndexedAccess?: boolean;
1404
-
1405
- /**
1406
- Report error if failed to find a source file for a side effect import.
1407
-
1408
- @default false
1409
- */
1410
- noUncheckedSideEffectImports?: boolean;
1411
-
1412
- /**
1413
- Report errors for fallthrough cases in switch statement.
1414
-
1415
- @default false
1416
- */
1417
- noFallthroughCasesInSwitch?: boolean;
1418
-
1419
- /**
1420
- Ensure overriding members in derived classes are marked with an override modifier.
1421
-
1422
- @default false
1423
- */
1424
- noImplicitOverride?: boolean;
1425
-
1426
- /**
1427
- Do not report errors on unreachable code.
1428
-
1429
- @default false
1430
- */
1431
- allowUnreachableCode?: boolean;
1432
-
1433
- /**
1434
- Disallow inconsistently-cased references to the same file.
1435
-
1436
- @default true
1437
- */
1438
- forceConsistentCasingInFileNames?: boolean;
1439
-
1440
- /**
1441
- Emit a v8 CPU profile of the compiler run for debugging.
1442
-
1443
- @default 'profile.cpuprofile'
1444
- */
1445
- generateCpuProfile?: string;
1446
-
1447
- /**
1448
- Generates an event trace and a list of types.
1449
- */
1450
- generateTrace?: boolean;
1451
-
1452
- /**
1453
- Base directory to resolve non-relative module names.
1454
- */
1455
- baseUrl?: string;
1456
-
1457
- /**
1458
- Specify path mapping to be computed relative to baseUrl option.
1459
- */
1460
- paths?: Record<string, string[]>;
1461
-
1462
- /**
1463
- List of TypeScript language server plugins to load.
1464
- */
1465
- plugins?: CompilerOptions.Plugin[];
1466
-
1467
- /**
1468
- Specify list of root directories to be used when resolving modules.
1469
- */
1470
- rootDirs?: string[];
1471
-
1472
- /**
1473
- Specify list of directories for type definition files to be included.
1474
- */
1475
- typeRoots?: string[];
1476
-
1477
- /**
1478
- Type declaration files to be included in compilation.
1479
- */
1480
- types?: string[];
1481
-
1482
- /**
1483
- Enable tracing of the name resolution process.
1484
-
1485
- @default false
1486
- */
1487
- traceResolution?: boolean;
1488
-
1489
- /**
1490
- Allow javascript files to be compiled.
1491
-
1492
- @default false
1493
- */
1494
- allowJs?: boolean;
1495
-
1496
- /**
1497
- Do not truncate error messages.
1498
-
1499
- @default false
1500
- */
1501
- noErrorTruncation?: boolean;
1502
-
1503
- /**
1504
- Allow default imports from modules with no default export. This does not affect code emit, just typechecking.
1505
-
1506
- @default module === 'system' || esModuleInterop
1507
- */
1508
- allowSyntheticDefaultImports?: boolean;
1509
-
1510
- /**
1511
- Do not emit `'use strict'` directives in module output.
1512
-
1513
- @default false
1514
- @deprecated This option will be removed in TypeScript 5.5.
1515
- */
1516
- noImplicitUseStrict?: boolean;
1517
-
1518
- /**
1519
- Enable to list all emitted files.
1520
-
1521
- @default false
1522
- */
1523
- listEmittedFiles?: boolean;
1524
-
1525
- /**
1526
- Disable size limit for JavaScript project.
1527
-
1528
- @default false
1529
- */
1530
- disableSizeLimit?: boolean;
1531
-
1532
- /**
1533
- List of library files to be included in the compilation.
1534
- */
1535
- lib?: CompilerOptions.Lib[];
1536
-
1537
- /**
1538
- Enable strict null checks.
1539
-
1540
- @default false
1541
- */
1542
- strictNullChecks?: boolean;
1543
-
1544
- /**
1545
- The maximum dependency depth to search under `node_modules` and load JavaScript files. Only applicable with `--allowJs`.
1546
-
1547
- @default 0
1548
- */
1549
- maxNodeModuleJsDepth?: number;
1550
-
1551
- /**
1552
- Import emit helpers (e.g. `__extends`, `__rest`, etc..) from tslib.
1553
-
1554
- @default false
1555
- */
1556
- importHelpers?: boolean;
1557
-
1558
- /**
1559
- Specify emit/checking behavior for imports that are only used for types.
1560
-
1561
- @default 'remove'
1562
- @deprecated Use `verbatimModuleSyntax` instead.
1563
- */
1564
- importsNotUsedAsValues?: CompilerOptions.ImportsNotUsedAsValues;
1565
-
1566
- /**
1567
- Parse in strict mode and emit `'use strict'` for each source file.
1568
-
1569
- @default false
1570
- */
1571
- alwaysStrict?: boolean;
1572
-
1573
- /**
1574
- Enable all strict type checking options.
1575
-
1576
- @default false
1577
- */
1578
- strict?: boolean;
1579
-
1580
- /**
1581
- Enable stricter checking of of the `bind`, `call`, and `apply` methods on functions.
1582
-
1583
- @default false
1584
- */
1585
- strictBindCallApply?: boolean;
1586
-
1587
- /**
1588
- Provide full support for iterables in `for-of`, spread, and destructuring when targeting `ES5` or `ES3`.
1589
-
1590
- @default false
1591
- */
1592
- downlevelIteration?: boolean;
1593
-
1594
- /**
1595
- Report errors in `.js` files.
1596
-
1597
- @default false
1598
- */
1599
- checkJs?: boolean;
1600
-
1601
- /**
1602
- Built-in iterators are instantiated with a `TReturn` type of undefined instead of `any`.
1603
-
1604
- @default false
1605
- */
1606
- strictBuiltinIteratorReturn?: boolean;
1607
-
1608
- /**
1609
- Disable bivariant parameter checking for function types.
1610
-
1611
- @default false
1612
- */
1613
- strictFunctionTypes?: boolean;
1614
-
1615
- /**
1616
- Ensure non-undefined class properties are initialized in the constructor.
1617
-
1618
- @default false
1619
- */
1620
- strictPropertyInitialization?: boolean;
1621
-
1622
- /**
1623
- Emit `__importStar` and `__importDefault` helpers for runtime Babel ecosystem compatibility and enable `--allowSyntheticDefaultImports` for typesystem compatibility.
1624
-
1625
- @default false
1626
- */
1627
- esModuleInterop?: boolean;
1628
-
1629
- /**
1630
- Allow accessing UMD globals from modules.
1631
-
1632
- @default false
1633
- */
1634
- allowUmdGlobalAccess?: boolean;
1635
-
1636
- /**
1637
- Resolve `keyof` to string valued property names only (no numbers or symbols).
1638
-
1639
- @default false
1640
- @deprecated This option will be removed in TypeScript 5.5.
1641
- */
1642
- keyofStringsOnly?: boolean;
1643
-
1644
- /**
1645
- Emit ECMAScript standard class fields.
1646
-
1647
- @default false
1648
- */
1649
- useDefineForClassFields?: boolean;
1650
-
1651
- /**
1652
- Generates a sourcemap for each corresponding `.d.ts` file.
1653
-
1654
- @default false
1655
- */
1656
- declarationMap?: boolean;
1657
-
1658
- /**
1659
- Include modules imported with `.json` extension.
1660
-
1661
- @default false
1662
- */
1663
- resolveJsonModule?: boolean;
1664
-
1665
- /**
1666
- Have recompiles in '--incremental' and '--watch' assume that changes within a file will only affect files directly depending on it.
1667
-
1668
- @default false
1669
- */
1670
- assumeChangesOnlyAffectDirectDependencies?: boolean;
1671
-
1672
- /**
1673
- Output more detailed compiler performance information after building.
1674
-
1675
- @default false
1676
- */
1677
- extendedDiagnostics?: boolean;
1678
-
1679
- /**
1680
- Print names of files that are part of the compilation and then stop processing.
1681
-
1682
- @default false
1683
- */
1684
- listFilesOnly?: boolean;
1685
-
1686
- /**
1687
- Disable preferring source files instead of declaration files when referencing composite projects.
1688
-
1689
- @default true if composite, false otherwise
1690
- */
1691
- disableSourceOfProjectReferenceRedirect?: boolean;
1692
-
1693
- /**
1694
- Opt a project out of multi-project reference checking when editing.
1695
-
1696
- @default false
1697
- */
1698
- disableSolutionSearching?: boolean;
1699
-
1700
- /**
1701
- Print names of files which TypeScript sees as a part of your project and the reason they are part of the compilation.
1702
-
1703
- @default false
1704
- */
1705
- explainFiles?: boolean;
1706
-
1707
- /**
1708
- Preserve unused imported values in the JavaScript output that would otherwise be removed.
1709
-
1710
- @default true
1711
- @deprecated Use `verbatimModuleSyntax` instead.
1712
- */
1713
- preserveValueImports?: boolean;
1714
-
1715
- /**
1716
- List of file name suffixes to search when resolving a module.
1717
- */
1718
- moduleSuffixes?: string[];
1719
-
1720
- /**
1721
- Control what method is used to detect module-format JS files.
1722
-
1723
- @default 'auto'
1724
- */
1725
- moduleDetection?: CompilerOptions.ModuleDetection;
1726
-
1727
- /**
1728
- Allows TypeScript files to import each other with a TypeScript-specific extension like .ts, .mts, or .tsx.
1729
-
1730
- @default false
1731
- */
1732
- allowImportingTsExtensions?: boolean;
1733
-
1734
- /**
1735
- Forces TypeScript to consult the exports field of package.json files if it ever reads from a package in node_modules.
1736
-
1737
- @default false
1738
- */
1739
- resolvePackageJsonExports?: boolean;
1740
-
1741
- /**
1742
- 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.
1743
-
1744
- @default false
1745
- */
1746
- resolvePackageJsonImports?: boolean;
1747
-
1748
- /**
1749
- Suppress errors for file formats that TypeScript does not understand.
1750
-
1751
- @default false
1752
- */
1753
- allowArbitraryExtensions?: boolean;
1754
-
1755
- /**
1756
- List of additional conditions that should succeed when TypeScript resolves from package.json.
1757
- */
1758
- customConditions?: string[];
1759
-
1760
- /**
1761
- Anything that uses the type modifier is dropped entirely.
1762
-
1763
- @default false
1764
- */
1765
- verbatimModuleSyntax?: boolean;
1766
-
1767
- /**
1768
- Suppress deprecation warnings
1769
- */
1770
- ignoreDeprecations?: CompilerOptions.IgnoreDeprecations;
1771
-
1772
- /**
1773
- Do not allow runtime constructs that are not part of ECMAScript.
1774
-
1775
- @default false
1776
- */
1777
- erasableSyntaxOnly?: boolean;
1778
-
1779
- /**
1780
- Enable lib replacement.
1781
-
1782
- @default true
1783
- */
1784
- libReplacement?: boolean;
1785
- };
1786
-
1787
- namespace WatchOptions {
1788
- export type WatchFileKind =
1789
- | 'FixedPollingInterval'
1790
- | 'PriorityPollingInterval'
1791
- | 'DynamicPriorityPolling'
1792
- | 'FixedChunkSizePolling'
1793
- | 'UseFsEvents'
1794
- | 'UseFsEventsOnParentDirectory';
1795
-
1796
- export type WatchDirectoryKind =
1797
- | 'UseFsEvents'
1798
- | 'FixedPollingInterval'
1799
- | 'DynamicPriorityPolling'
1800
- | 'FixedChunkSizePolling';
1801
-
1802
- export type PollingWatchKind =
1803
- | 'FixedInterval'
1804
- | 'PriorityInterval'
1805
- | 'DynamicPriority'
1806
- | 'FixedChunkSize';
1807
- }
1808
-
1809
- export type WatchOptions = {
1810
-
1811
- /**
1812
- Specify the strategy for watching individual files.
1813
-
1814
- @default 'UseFsEvents'
1815
- */
1816
- watchFile?: WatchOptions.WatchFileKind | Lowercase<WatchOptions.WatchFileKind>;
1817
-
1818
- /**
1819
- Specify the strategy for watching directories under systems that lack recursive file-watching functionality.
1820
-
1821
- @default 'UseFsEvents'
1822
- */
1823
- watchDirectory?: WatchOptions.WatchDirectoryKind | Lowercase<WatchOptions.WatchDirectoryKind>;
1824
-
1825
- /**
1826
- Specify the polling strategy to use when the system runs out of or doesn't support native file watchers.
1827
- */
1828
- fallbackPolling?: WatchOptions.PollingWatchKind | Lowercase<WatchOptions.PollingWatchKind>;
1829
-
1830
- /**
1831
- Enable synchronous updates on directory watchers for platforms that don't support recursive watching natively.
1832
- */
1833
- synchronousWatchDirectory?: boolean;
1834
-
1835
- /**
1836
- Specifies a list of directories to exclude from watch.
1837
- */
1838
- excludeDirectories?: string[];
1839
-
1840
- /**
1841
- Specifies a list of files to exclude from watch.
1842
- */
1843
- excludeFiles?: string[];
1844
- };
1845
-
1846
- /**
1847
- Auto type (.d.ts) acquisition options for this project.
1848
- */
1849
- export type TypeAcquisition = {
1850
- /**
1851
- Enable auto type acquisition.
1852
- */
1853
- enable?: boolean;
1854
-
1855
- /**
1856
- Specifies a list of type declarations to be included in auto type acquisition. For example, `['jquery', 'lodash']`.
1857
- */
1858
- include?: string[];
1859
-
1860
- /**
1861
- Specifies a list of type declarations to be excluded from auto type acquisition. For example, `['jquery', 'lodash']`.
1862
- */
1863
- exclude?: string[];
1864
-
1865
- /**
1866
- Disable infering what types should be added based on filenames in a project.
1867
- */
1868
- disableFilenameBasedTypeAcquisition?: boolean;
1869
- };
1870
-
1871
- export type References = {
1872
- /**
1873
- A normalized path on disk.
1874
- */
1875
- path: string;
1876
-
1877
- /**
1878
- The path as the user originally wrote it.
1879
- */
1880
- originalPath?: string;
1881
-
1882
- /**
1883
- True if the output of this reference should be prepended to the output of this project.
1884
-
1885
- Only valid for `--outFile` compilations.
1886
- @deprecated This option will be removed in TypeScript 5.5.
1887
- */
1888
- prepend?: boolean;
1889
-
1890
- /**
1891
- True if it is intended that this reference form a circularity.
1892
- */
1893
- circular?: boolean;
1894
- };
1895
- }
1896
-
1897
- /**
1898
- Type for [TypeScript's `tsconfig.json` file](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) (TypeScript 3.7).
1899
-
1900
- @category File
1901
- */
1902
- type TsConfigJson = {
1903
- /**
1904
- Instructs the TypeScript compiler how to compile `.ts` files.
1905
- */
1906
- compilerOptions?: TsConfigJson.CompilerOptions;
1907
-
1908
- /**
1909
- Instructs the TypeScript compiler how to watch files.
1910
- */
1911
- watchOptions?: TsConfigJson.WatchOptions;
1912
-
1913
- /**
1914
- Auto type (.d.ts) acquisition options for this project.
1915
- */
1916
- typeAcquisition?: TsConfigJson.TypeAcquisition;
1917
-
1918
- /**
1919
- Enable Compile-on-Save for this project.
1920
- */
1921
- compileOnSave?: boolean;
1922
-
1923
- /**
1924
- Path to base configuration file to inherit from.
1925
- */
1926
- extends?: string | string[];
1927
-
1928
- /**
1929
- 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.
1930
- */
1931
- files?: string[];
1932
-
1933
- /**
1934
- 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.
1935
-
1936
- Glob patterns require TypeScript version 2.0 or later.
1937
- */
1938
- exclude?: string[];
1939
-
1940
- /**
1941
- Specifies a list of glob patterns that match files to be included in compilation.
1942
-
1943
- 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`.
1944
- */
1945
- include?: string[];
1946
-
1947
- /**
1948
- Referenced projects.
1949
- */
1950
- references?: TsConfigJson.References[];
1951
- };
1952
-
1953
5
  type TsConfigJsonResolved = Except<TsConfigJson, "extends">;
1954
6
 
1955
7
  type Options$1 = {
@@ -1976,4 +28,5 @@ declare const writeTsConfigSync: (tsConfig: TsConfigJson, options?: WriteJsonOpt
1976
28
  cwd?: URL | string;
1977
29
  }) => void;
1978
30
 
1979
- export { type Options as FindTsConfigOptions, type Options$1 as ReadTsConfigOptions, TsConfigJson, type TsConfigJsonResolved, type TsConfigResult, findTsConfig, findTsConfigSync, implicitBaseUrlSymbol, readTsConfig, writeTsConfig, writeTsConfigSync };
31
+ export { findTsConfig, findTsConfigSync, implicitBaseUrlSymbol, readTsConfig, writeTsConfig, writeTsConfigSync };
32
+ export type { Options as FindTsConfigOptions, Options$1 as ReadTsConfigOptions, TsConfigJsonResolved, TsConfigResult };