azure-mock 2.17.0 → 2.18.2
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/LICENSE +201 -201
- package/README.md +45 -45
- package/dist/index.d.ts +98 -80
- package/dist/index.js +457 -462
- package/package.json +9 -9
package/dist/index.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ declare class MockBlobBatchClient implements BlobBatchClient {
|
|
|
78
78
|
getContainer(containerName: string): MapValue<typeof MockContainerDatabase>;
|
|
79
79
|
}
|
|
80
80
|
//#endregion
|
|
81
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
81
|
+
//#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/is-any.d.ts
|
|
82
82
|
/**
|
|
83
83
|
Returns a boolean for whether the given type is `any`.
|
|
84
84
|
|
|
@@ -93,8 +93,8 @@ import type {IsAny} from 'type-fest';
|
|
|
93
93
|
const typedObject = {a: 1, b: 2} as const;
|
|
94
94
|
const anyObject: any = {a: 1, b: 2};
|
|
95
95
|
|
|
96
|
-
function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(
|
|
97
|
-
return
|
|
96
|
+
function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(object: O, key: K) {
|
|
97
|
+
return object[key];
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
const typedA = get(typedObject, 'a');
|
|
@@ -109,7 +109,7 @@ const anyA = get(anyObject, 'a');
|
|
|
109
109
|
*/
|
|
110
110
|
type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
|
|
111
111
|
//#endregion
|
|
112
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
112
|
+
//#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/is-optional-key-of.d.ts
|
|
113
113
|
/**
|
|
114
114
|
Returns a boolean for whether the given key is an optional key of type.
|
|
115
115
|
|
|
@@ -119,17 +119,17 @@ This is useful when writing utility types or schema validators that need to diff
|
|
|
119
119
|
```
|
|
120
120
|
import type {IsOptionalKeyOf} from 'type-fest';
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
type User = {
|
|
123
123
|
name: string;
|
|
124
124
|
surname: string;
|
|
125
125
|
|
|
126
126
|
luckyNumber?: number;
|
|
127
|
-
}
|
|
127
|
+
};
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
type Admin = {
|
|
130
130
|
name: string;
|
|
131
131
|
surname?: string;
|
|
132
|
-
}
|
|
132
|
+
};
|
|
133
133
|
|
|
134
134
|
type T1 = IsOptionalKeyOf<User, 'luckyNumber'>;
|
|
135
135
|
//=> true
|
|
@@ -152,7 +152,7 @@ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
|
|
|
152
152
|
*/
|
|
153
153
|
type IsOptionalKeyOf<Type extends object, Key$1 extends keyof Type> = IsAny<Type | Key$1> extends true ? never : Key$1 extends keyof Type ? Type extends Record<Key$1, Type[Key$1]> ? false : true : false;
|
|
154
154
|
//#endregion
|
|
155
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
155
|
+
//#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/optional-keys-of.d.ts
|
|
156
156
|
/**
|
|
157
157
|
Extract all optional keys from the given type.
|
|
158
158
|
|
|
@@ -162,12 +162,12 @@ This is useful when you want to create a new type that contains different type v
|
|
|
162
162
|
```
|
|
163
163
|
import type {OptionalKeysOf, Except} from 'type-fest';
|
|
164
164
|
|
|
165
|
-
|
|
165
|
+
type User = {
|
|
166
166
|
name: string;
|
|
167
167
|
surname: string;
|
|
168
168
|
|
|
169
169
|
luckyNumber?: number;
|
|
170
|
-
}
|
|
170
|
+
};
|
|
171
171
|
|
|
172
172
|
const REMOVE_FIELD = Symbol('remove field symbol');
|
|
173
173
|
type UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKeysOf<Entity>> & {
|
|
@@ -175,12 +175,12 @@ type UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKe
|
|
|
175
175
|
};
|
|
176
176
|
|
|
177
177
|
const update1: UpdateOperation<User> = {
|
|
178
|
-
name: 'Alice'
|
|
178
|
+
name: 'Alice',
|
|
179
179
|
};
|
|
180
180
|
|
|
181
181
|
const update2: UpdateOperation<User> = {
|
|
182
182
|
name: 'Bob',
|
|
183
|
-
luckyNumber: REMOVE_FIELD
|
|
183
|
+
luckyNumber: REMOVE_FIELD,
|
|
184
184
|
};
|
|
185
185
|
```
|
|
186
186
|
|
|
@@ -190,7 +190,7 @@ type OptionalKeysOf<Type extends object> = Type extends unknown // For distribut
|
|
|
190
190
|
? (keyof { [Key in keyof Type as IsOptionalKeyOf<Type, Key> extends false ? never : Key]: never }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
|
|
191
191
|
: never;
|
|
192
192
|
//#endregion
|
|
193
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
193
|
+
//#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/required-keys-of.d.ts
|
|
194
194
|
/**
|
|
195
195
|
Extract all required keys from the given type.
|
|
196
196
|
|
|
@@ -200,17 +200,23 @@ This is useful when you want to create a new type that contains different type v
|
|
|
200
200
|
```
|
|
201
201
|
import type {RequiredKeysOf} from 'type-fest';
|
|
202
202
|
|
|
203
|
-
declare function createValidation<
|
|
203
|
+
declare function createValidation<
|
|
204
|
+
Entity extends object,
|
|
205
|
+
Key extends RequiredKeysOf<Entity> = RequiredKeysOf<Entity>,
|
|
206
|
+
>(field: Key, validator: (value: Entity[Key]) => boolean): (entity: Entity) => boolean;
|
|
204
207
|
|
|
205
|
-
|
|
208
|
+
type User = {
|
|
206
209
|
name: string;
|
|
207
210
|
surname: string;
|
|
208
|
-
|
|
209
211
|
luckyNumber?: number;
|
|
210
|
-
}
|
|
212
|
+
};
|
|
211
213
|
|
|
212
214
|
const validator1 = createValidation<User>('name', value => value.length < 25);
|
|
213
215
|
const validator2 = createValidation<User>('surname', value => value.length < 25);
|
|
216
|
+
|
|
217
|
+
// @ts-expect-error
|
|
218
|
+
const validator3 = createValidation<User>('luckyNumber', value => value > 0);
|
|
219
|
+
// Error: Argument of type '"luckyNumber"' is not assignable to parameter of type '"name" | "surname"'.
|
|
214
220
|
```
|
|
215
221
|
|
|
216
222
|
@category Utilities
|
|
@@ -218,7 +224,7 @@ const validator2 = createValidation<User>('surname', value => value.length < 25)
|
|
|
218
224
|
type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
|
|
219
225
|
? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
|
|
220
226
|
//#endregion
|
|
221
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
227
|
+
//#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/is-never.d.ts
|
|
222
228
|
/**
|
|
223
229
|
Returns a boolean for whether the given type is `never`.
|
|
224
230
|
|
|
@@ -232,29 +238,41 @@ Useful in type utilities, such as checking if something does not occur.
|
|
|
232
238
|
```
|
|
233
239
|
import type {IsNever, And} from 'type-fest';
|
|
234
240
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
And<
|
|
238
|
-
IsNever<Exclude<A, B>> extends true ? true : false,
|
|
239
|
-
IsNever<Exclude<B, A>> extends true ? true : false
|
|
240
|
-
>;
|
|
241
|
-
|
|
242
|
-
type EndIfEqual<I extends string, O extends string> =
|
|
243
|
-
AreStringsEqual<I, O> extends true
|
|
244
|
-
? never
|
|
245
|
-
: void;
|
|
246
|
-
|
|
247
|
-
function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
|
|
248
|
-
if (input === output) {
|
|
249
|
-
process.exit(0);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
241
|
+
type A = IsNever<never>;
|
|
242
|
+
//=> true
|
|
252
243
|
|
|
253
|
-
|
|
254
|
-
//=>
|
|
244
|
+
type B = IsNever<any>;
|
|
245
|
+
//=> false
|
|
246
|
+
|
|
247
|
+
type C = IsNever<unknown>;
|
|
248
|
+
//=> false
|
|
249
|
+
|
|
250
|
+
type D = IsNever<never[]>;
|
|
251
|
+
//=> false
|
|
255
252
|
|
|
256
|
-
|
|
257
|
-
//=>
|
|
253
|
+
type E = IsNever<object>;
|
|
254
|
+
//=> false
|
|
255
|
+
|
|
256
|
+
type F = IsNever<string>;
|
|
257
|
+
//=> false
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
@example
|
|
261
|
+
```
|
|
262
|
+
import type {IsNever} from 'type-fest';
|
|
263
|
+
|
|
264
|
+
type IsTrue<T> = T extends true ? true : false;
|
|
265
|
+
|
|
266
|
+
// When a distributive conditional is instantiated with `never`, the entire conditional results in `never`.
|
|
267
|
+
type A = IsTrue<never>;
|
|
268
|
+
// ^? type A = never
|
|
269
|
+
|
|
270
|
+
// If you don't want that behaviour, you can explicitly add an `IsNever` check before the distributive conditional.
|
|
271
|
+
type IsTrueFixed<T> =
|
|
272
|
+
IsNever<T> extends true ? false : T extends true ? true : false;
|
|
273
|
+
|
|
274
|
+
type B = IsTrueFixed<never>;
|
|
275
|
+
// ^? type B = false
|
|
258
276
|
```
|
|
259
277
|
|
|
260
278
|
@category Type Guard
|
|
@@ -262,7 +280,7 @@ endIfEqual('abc', '123');
|
|
|
262
280
|
*/
|
|
263
281
|
type IsNever<T> = [T] extends [never] ? true : false;
|
|
264
282
|
//#endregion
|
|
265
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
283
|
+
//#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/if.d.ts
|
|
266
284
|
/**
|
|
267
285
|
An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
|
|
268
286
|
|
|
@@ -275,7 +293,7 @@ Note:
|
|
|
275
293
|
|
|
276
294
|
@example
|
|
277
295
|
```
|
|
278
|
-
import {If} from 'type-fest';
|
|
296
|
+
import type {If} from 'type-fest';
|
|
279
297
|
|
|
280
298
|
type A = If<true, 'yes', 'no'>;
|
|
281
299
|
//=> 'yes'
|
|
@@ -295,7 +313,7 @@ type E = If<never, 'yes', 'no'>;
|
|
|
295
313
|
|
|
296
314
|
@example
|
|
297
315
|
```
|
|
298
|
-
import {If, IsAny, IsNever} from 'type-fest';
|
|
316
|
+
import type {If, IsAny, IsNever} from 'type-fest';
|
|
299
317
|
|
|
300
318
|
type A = If<IsAny<unknown>, 'is any', 'not any'>;
|
|
301
319
|
//=> 'not any'
|
|
@@ -306,7 +324,7 @@ type B = If<IsNever<never>, 'is never', 'not never'>;
|
|
|
306
324
|
|
|
307
325
|
@example
|
|
308
326
|
```
|
|
309
|
-
import {If, IsEqual} from 'type-fest';
|
|
327
|
+
import type {If, IsEqual} from 'type-fest';
|
|
310
328
|
|
|
311
329
|
type IfEqual<T, U, IfBranch, ElseBranch> = If<IsEqual<T, U>, IfBranch, ElseBranch>;
|
|
312
330
|
|
|
@@ -357,7 +375,7 @@ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
|
|
|
357
375
|
*/
|
|
358
376
|
type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
|
|
359
377
|
//#endregion
|
|
360
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
378
|
+
//#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/simplify.d.ts
|
|
361
379
|
/**
|
|
362
380
|
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.
|
|
363
381
|
|
|
@@ -403,10 +421,11 @@ const literal = {foo: 123, bar: 'hello', baz: 456};
|
|
|
403
421
|
const someType: SomeType = literal;
|
|
404
422
|
const someInterface: SomeInterface = literal;
|
|
405
423
|
|
|
406
|
-
function fn(object: Record<string, unknown>): void
|
|
424
|
+
declare function fn(object: Record<string, unknown>): void;
|
|
407
425
|
|
|
408
426
|
fn(literal); // Good: literal object type is sealed
|
|
409
427
|
fn(someType); // Good: type is sealed
|
|
428
|
+
// @ts-expect-error
|
|
410
429
|
fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
|
|
411
430
|
fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
|
|
412
431
|
```
|
|
@@ -417,7 +436,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
|
|
|
417
436
|
*/
|
|
418
437
|
type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
|
|
419
438
|
//#endregion
|
|
420
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
439
|
+
//#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/is-equal.d.ts
|
|
421
440
|
/**
|
|
422
441
|
Returns a boolean for whether the two given types are equal.
|
|
423
442
|
|
|
@@ -444,11 +463,11 @@ type Includes<Value extends readonly any[], Item> =
|
|
|
444
463
|
@category Type Guard
|
|
445
464
|
@category Utilities
|
|
446
465
|
*/
|
|
447
|
-
type IsEqual<A, B> = [A
|
|
466
|
+
type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false : false;
|
|
448
467
|
// This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
|
|
449
468
|
type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
|
|
450
469
|
//#endregion
|
|
451
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
470
|
+
//#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/omit-index-signature.d.ts
|
|
452
471
|
/**
|
|
453
472
|
Omit any index signatures from the given object type, leaving only explicitly defined properties.
|
|
454
473
|
|
|
@@ -466,6 +485,7 @@ It relies on the fact that an empty object (`{}`) is assignable to an object wit
|
|
|
466
485
|
```
|
|
467
486
|
const indexed: Record<string, unknown> = {}; // Allowed
|
|
468
487
|
|
|
488
|
+
// @ts-expect-error
|
|
469
489
|
const keyed: Record<'foo', unknown> = {}; // Error
|
|
470
490
|
// => TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
|
|
471
491
|
```
|
|
@@ -479,16 +499,14 @@ type Indexed = {} extends Record<string, unknown>
|
|
|
479
499
|
// => '✅ `{}` is assignable to `Record<string, unknown>`'
|
|
480
500
|
|
|
481
501
|
type Keyed = {} extends Record<'foo' | 'bar', unknown>
|
|
482
|
-
?
|
|
483
|
-
:
|
|
502
|
+
? '✅ `{}` is assignable to `Record<\'foo\' | \'bar\', unknown>`'
|
|
503
|
+
: '❌ `{}` is NOT assignable to `Record<\'foo\' | \'bar\', unknown>`';
|
|
484
504
|
// => "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`"
|
|
485
505
|
```
|
|
486
506
|
|
|
487
507
|
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`...
|
|
488
508
|
|
|
489
509
|
```
|
|
490
|
-
import type {OmitIndexSignature} from 'type-fest';
|
|
491
|
-
|
|
492
510
|
type OmitIndexSignature<ObjectType> = {
|
|
493
511
|
[KeyType in keyof ObjectType // Map each key of `ObjectType`...
|
|
494
512
|
]: ObjectType[KeyType]; // ...to its original value, i.e. `OmitIndexSignature<Foo> == Foo`.
|
|
@@ -498,14 +516,12 @@ type OmitIndexSignature<ObjectType> = {
|
|
|
498
516
|
...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record<KeyType, unknown>`)...
|
|
499
517
|
|
|
500
518
|
```
|
|
501
|
-
import type {OmitIndexSignature} from 'type-fest';
|
|
502
|
-
|
|
503
519
|
type OmitIndexSignature<ObjectType> = {
|
|
504
520
|
[KeyType in keyof ObjectType
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
521
|
+
// Is `{}` assignable to `Record<KeyType, unknown>`?
|
|
522
|
+
as {} extends Record<KeyType, unknown>
|
|
523
|
+
? never // ✅ `{}` is assignable to `Record<KeyType, unknown>`
|
|
524
|
+
: KeyType // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`
|
|
509
525
|
]: ObjectType[KeyType];
|
|
510
526
|
};
|
|
511
527
|
```
|
|
@@ -516,21 +532,21 @@ If `{}` is assignable, it means that `KeyType` is an index signature and we want
|
|
|
516
532
|
```
|
|
517
533
|
import type {OmitIndexSignature} from 'type-fest';
|
|
518
534
|
|
|
519
|
-
|
|
535
|
+
type Example = {
|
|
520
536
|
// These index signatures will be removed.
|
|
521
|
-
[x: string]: any
|
|
522
|
-
[x: number]: any
|
|
523
|
-
[x: symbol]: any
|
|
524
|
-
[x: `head-${string}`]: string
|
|
525
|
-
[x: `${string}-tail`]: string
|
|
526
|
-
[x: `head-${string}-tail`]: string
|
|
527
|
-
[x: `${bigint}`]: string
|
|
528
|
-
[x: `embedded-${number}`]: string
|
|
537
|
+
[x: string]: any;
|
|
538
|
+
[x: number]: any;
|
|
539
|
+
[x: symbol]: any;
|
|
540
|
+
[x: `head-${string}`]: string;
|
|
541
|
+
[x: `${string}-tail`]: string;
|
|
542
|
+
[x: `head-${string}-tail`]: string;
|
|
543
|
+
[x: `${bigint}`]: string;
|
|
544
|
+
[x: `embedded-${number}`]: string;
|
|
529
545
|
|
|
530
546
|
// These explicitly defined keys will remain.
|
|
531
547
|
foo: 'bar';
|
|
532
548
|
qux?: 'baz';
|
|
533
|
-
}
|
|
549
|
+
};
|
|
534
550
|
|
|
535
551
|
type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
|
|
536
552
|
// => { foo: 'bar'; qux?: 'baz' | undefined; }
|
|
@@ -541,7 +557,7 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
|
|
|
541
557
|
*/
|
|
542
558
|
type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
|
|
543
559
|
//#endregion
|
|
544
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
560
|
+
//#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/pick-index-signature.d.ts
|
|
545
561
|
/**
|
|
546
562
|
Pick only index signatures from the given object type, leaving out all explicitly defined properties.
|
|
547
563
|
|
|
@@ -589,7 +605,7 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
|
|
|
589
605
|
*/
|
|
590
606
|
type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
|
|
591
607
|
//#endregion
|
|
592
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
608
|
+
//#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/merge.d.ts
|
|
593
609
|
// Merges two objects without worrying about index signatures.
|
|
594
610
|
type SimpleMerge<Destination, Source> = { [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source;
|
|
595
611
|
|
|
@@ -600,12 +616,12 @@ Merge two types into a new type. Keys of the second type overrides keys of the f
|
|
|
600
616
|
```
|
|
601
617
|
import type {Merge} from 'type-fest';
|
|
602
618
|
|
|
603
|
-
|
|
619
|
+
type Foo = {
|
|
604
620
|
[x: string]: unknown;
|
|
605
621
|
[x: number]: unknown;
|
|
606
622
|
foo: string;
|
|
607
623
|
bar: symbol;
|
|
608
|
-
}
|
|
624
|
+
};
|
|
609
625
|
|
|
610
626
|
type Bar = {
|
|
611
627
|
[x: number]: number;
|
|
@@ -629,7 +645,7 @@ export type FooBar = Merge<Foo, Bar>;
|
|
|
629
645
|
*/
|
|
630
646
|
type Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
|
|
631
647
|
//#endregion
|
|
632
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
648
|
+
//#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/internal/object.d.ts
|
|
633
649
|
/**
|
|
634
650
|
Merges user specified options with default options.
|
|
635
651
|
|
|
@@ -684,7 +700,7 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
|
|
|
684
700
|
*/
|
|
685
701
|
type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = If<IsAny<SpecifiedOptions>, Defaults, If<IsNever<SpecifiedOptions>, Defaults, Simplify<Merge<Defaults, { [Key in keyof SpecifiedOptions as Key extends OptionalKeysOf<Options> ? undefined extends SpecifiedOptions[Key] ? never : Key : Key]: SpecifiedOptions[Key] }> & Required<Options>>>>;
|
|
686
702
|
//#endregion
|
|
687
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
703
|
+
//#region ../../node_modules/.pnpm/type-fest@5.3.1/node_modules/type-fest/source/except.d.ts
|
|
688
704
|
/**
|
|
689
705
|
Filter out keys from an object.
|
|
690
706
|
|
|
@@ -746,12 +762,14 @@ type Foo = {
|
|
|
746
762
|
type FooWithoutA = Except<Foo, 'a'>;
|
|
747
763
|
//=> {b: string}
|
|
748
764
|
|
|
765
|
+
// @ts-expect-error
|
|
749
766
|
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
750
767
|
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
751
768
|
|
|
752
769
|
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
753
770
|
//=> {a: number} & Partial<Record<"b", never>>
|
|
754
771
|
|
|
772
|
+
// @ts-expect-error
|
|
755
773
|
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
756
774
|
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
757
775
|
|
|
@@ -768,12 +786,12 @@ type UserData = {
|
|
|
768
786
|
|
|
769
787
|
// `Omit` clearly doesn't behave as expected in this case:
|
|
770
788
|
type PostPayload = Omit<UserData, 'email'>;
|
|
771
|
-
//=>
|
|
789
|
+
//=> { [x: string]: string; [x: number]: string; }
|
|
772
790
|
|
|
773
791
|
// In situations like this, `Except` works better.
|
|
774
792
|
// It simply removes the `email` key while preserving all the other keys.
|
|
775
|
-
type
|
|
776
|
-
//=>
|
|
793
|
+
type PostPayloadFixed = Except<UserData, 'email'>;
|
|
794
|
+
//=> { [x: string]: string; name: string; role: 'admin' | 'user'; }
|
|
777
795
|
```
|
|
778
796
|
|
|
779
797
|
@category Object
|
|
@@ -1068,7 +1086,7 @@ interface OperationTracingOptions {
|
|
|
1068
1086
|
tracingContext?: TracingContext;
|
|
1069
1087
|
}
|
|
1070
1088
|
//#endregion
|
|
1071
|
-
//#region ../../node_modules/.pnpm/@azure+core-rest-pipeline@1.22.
|
|
1089
|
+
//#region ../../node_modules/.pnpm/@azure+core-rest-pipeline@1.22.2/node_modules/@azure/core-rest-pipeline/dist/esm/interfaces.d.ts
|
|
1072
1090
|
/**
|
|
1073
1091
|
* A HttpHeaders collection represented as a simple JSON object.
|
|
1074
1092
|
*/
|
|
@@ -1393,7 +1411,7 @@ interface PxfObject {
|
|
|
1393
1411
|
passphrase?: string | undefined;
|
|
1394
1412
|
}
|
|
1395
1413
|
//#endregion
|
|
1396
|
-
//#region ../../node_modules/.pnpm/@azure+core-rest-pipeline@1.22.
|
|
1414
|
+
//#region ../../node_modules/.pnpm/@azure+core-rest-pipeline@1.22.2/node_modules/@azure/core-rest-pipeline/dist/esm/index.d.ts
|
|
1397
1415
|
declare global {
|
|
1398
1416
|
interface FormData {}
|
|
1399
1417
|
interface Blob {}
|