cypress 15.8.1 → 15.9.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/angular/angular/dist/index.js +1 -1
- package/angular/dist/index.js +1 -1
- package/angular-zoneless/angular-zoneless/dist/index.js +1 -1
- package/angular-zoneless/dist/index.js +1 -1
- package/dist/errors.js +8 -10
- package/dist/exec/open.js +3 -6
- package/mount-utils/mount-utils/package.json +1 -0
- package/mount-utils/package.json +1 -0
- package/package.json +4 -4
- package/react/dist/cypress-react.cjs.js +1 -1
- package/react/dist/cypress-react.esm-bundler.js +1 -1
- package/react/package.json +1 -4
- package/react/react/dist/cypress-react.cjs.js +1 -1
- package/react/react/dist/cypress-react.esm-bundler.js +1 -1
- package/react/react/package.json +1 -4
- package/svelte/dist/cypress-svelte.cjs.js +1 -1
- package/svelte/dist/cypress-svelte.esm-bundler.js +1 -1
- package/svelte/svelte/dist/cypress-svelte.cjs.js +1 -1
- package/svelte/svelte/dist/cypress-svelte.esm-bundler.js +1 -1
- package/types/cypress.d.ts +5 -5
- package/types/lodash/common/array.d.ts +41 -30
- package/types/lodash/common/collection.d.ts +10 -2
- package/types/lodash/common/common.d.ts +20 -13
- package/types/lodash/common/function.d.ts +35 -10
- package/types/lodash/common/lang.d.ts +11 -3
- package/types/lodash/common/math.d.ts +3 -1
- package/types/lodash/common/object.d.ts +144 -20
- package/types/lodash/common/seq.d.ts +2 -2
- package/types/lodash/common/string.d.ts +21 -21
- package/types/lodash/common/util.d.ts +4 -3
- package/types/lodash/fp.d.ts +156 -132
- package/types/lodash/index.d.ts +1 -26
- package/types/net-stubbing.d.ts +7 -2
- package/vue/dist/cypress-vue.cjs.js +1 -1
- package/vue/dist/cypress-vue.esm-bundler.js +1 -1
- package/vue/package.json +1 -4
- package/vue/vue/dist/cypress-vue.cjs.js +1 -1
- package/vue/vue/dist/cypress-vue.esm-bundler.js +1 -1
- package/vue/vue/package.json +1 -4
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import _ = require("../index");
|
|
2
|
-
//
|
|
2
|
+
// eslint-disable-next-line @definitelytyped/strict-export-declare-modifiers
|
|
3
3
|
type GlobalPartial<T> = Partial<T>;
|
|
4
|
+
export const uniqueSymbol: unique symbol;
|
|
4
5
|
declare module "../index" {
|
|
5
6
|
type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>;
|
|
6
7
|
type PartialObject<T> = GlobalPartial<T>;
|
|
7
|
-
type Many<T> = T |
|
|
8
|
+
type Many<T> = T | readonly T[];
|
|
8
9
|
type ImpChain<T> =
|
|
9
10
|
T extends { __trapAny: any } ? Collection<any> & Function<any> & Object<any> & Primitive<any> & String :
|
|
10
11
|
T extends null | undefined ? never :
|
|
11
|
-
T extends string
|
|
12
|
+
T extends string ? String<T> :
|
|
12
13
|
T extends (...args: any) => any ? Function<T> :
|
|
13
14
|
T extends List<infer U> | null | undefined ? Collection<U> :
|
|
14
15
|
T extends object | null | undefined ? Object<T> :
|
|
@@ -16,8 +17,7 @@ declare module "../index" {
|
|
|
16
17
|
type ExpChain<T> =
|
|
17
18
|
T extends { __trapAny: any } ? CollectionChain<any> & FunctionChain<any> & ObjectChain<any> & PrimitiveChain<any> & StringChain :
|
|
18
19
|
T extends null | undefined ? never :
|
|
19
|
-
T extends string ? StringChain :
|
|
20
|
-
T extends string | null | undefined ? StringNullableChain :
|
|
20
|
+
T extends string ? StringChain<T> :
|
|
21
21
|
T extends (...args: any) => any ? FunctionChain<T> :
|
|
22
22
|
T extends List<infer U> | null | undefined ? CollectionChain<U> :
|
|
23
23
|
T extends object | null | undefined ? ObjectChain<T> :
|
|
@@ -92,6 +92,7 @@ declare module "../index" {
|
|
|
92
92
|
* upperFirst, value, and words.
|
|
93
93
|
**/
|
|
94
94
|
<TrapAny extends { __trapAny: any }>(value: TrapAny): Collection<any> & Function<any> & Object<any> & Primitive<any> & String;
|
|
95
|
+
<T extends string>(value: T): String<T>;
|
|
95
96
|
<T extends null | undefined>(value: T): Primitive<T>;
|
|
96
97
|
(value: string | null | undefined): String;
|
|
97
98
|
<T extends (...args: any) => any>(value: T): Function<T>;
|
|
@@ -116,23 +117,23 @@ declare module "../index" {
|
|
|
116
117
|
/**
|
|
117
118
|
* The "escape" delimiter.
|
|
118
119
|
**/
|
|
119
|
-
escape?: RegExp;
|
|
120
|
+
escape?: RegExp | null | undefined;
|
|
120
121
|
/**
|
|
121
122
|
* The "evaluate" delimiter.
|
|
122
123
|
**/
|
|
123
|
-
evaluate?: RegExp;
|
|
124
|
+
evaluate?: RegExp | null | undefined;
|
|
124
125
|
/**
|
|
125
126
|
* An object to import into the template as local variables.
|
|
126
127
|
*/
|
|
127
|
-
imports?: Dictionary<any
|
|
128
|
+
imports?: Dictionary<any> | undefined;
|
|
128
129
|
/**
|
|
129
130
|
* The "interpolate" delimiter.
|
|
130
131
|
*/
|
|
131
|
-
interpolate?: RegExp;
|
|
132
|
+
interpolate?: RegExp | null | undefined;
|
|
132
133
|
/**
|
|
133
134
|
* Used to reference the data object in the template text.
|
|
134
135
|
*/
|
|
135
|
-
variable?: string;
|
|
136
|
+
variable?: string | undefined;
|
|
136
137
|
}
|
|
137
138
|
/**
|
|
138
139
|
* Creates a cache object to store key/value pairs.
|
|
@@ -166,7 +167,7 @@ declare module "../index" {
|
|
|
166
167
|
/**
|
|
167
168
|
* Removes all key-value entries from the map.
|
|
168
169
|
*/
|
|
169
|
-
clear?: () => void;
|
|
170
|
+
clear?: (() => void) | undefined;
|
|
170
171
|
}
|
|
171
172
|
interface MapCacheConstructor {
|
|
172
173
|
new (): MapCache;
|
|
@@ -189,7 +190,7 @@ declare module "../index" {
|
|
|
189
190
|
}
|
|
190
191
|
interface Function<T extends (...args: any) => any> extends LoDashImplicitWrapper<T> {
|
|
191
192
|
}
|
|
192
|
-
interface String extends LoDashImplicitWrapper<
|
|
193
|
+
interface String<T extends string = string> extends LoDashImplicitWrapper<T> {
|
|
193
194
|
}
|
|
194
195
|
interface Object<T> extends LoDashImplicitWrapper<T> {
|
|
195
196
|
}
|
|
@@ -199,7 +200,7 @@ declare module "../index" {
|
|
|
199
200
|
}
|
|
200
201
|
interface FunctionChain<T extends (...args: any) => any> extends LoDashExplicitWrapper<T> {
|
|
201
202
|
}
|
|
202
|
-
interface StringChain extends LoDashExplicitWrapper<
|
|
203
|
+
interface StringChain<T extends string = string> extends LoDashExplicitWrapper<T> {
|
|
203
204
|
}
|
|
204
205
|
interface StringNullableChain extends LoDashExplicitWrapper<string | undefined> {
|
|
205
206
|
}
|
|
@@ -212,6 +213,7 @@ declare module "../index" {
|
|
|
212
213
|
type NotVoid = unknown;
|
|
213
214
|
type IterateeShorthand<T> = PropertyName | [PropertyName, any] | PartialShallow<T>;
|
|
214
215
|
type ArrayIterator<T, TResult> = (value: T, index: number, collection: T[]) => TResult;
|
|
216
|
+
type TupleIterator<T extends readonly unknown[], TResult> = (value: T[number], index: StringToNumber<keyof T>, collection: T) => TResult;
|
|
215
217
|
type ListIterator<T, TResult> = (value: T, index: number, collection: List<T>) => TResult;
|
|
216
218
|
type ListIteratee<T> = ListIterator<T, NotVoid> | IterateeShorthand<T>;
|
|
217
219
|
type ListIterateeCustom<T, TResult> = ListIterator<T, TResult> | IterateeShorthand<T>;
|
|
@@ -244,6 +246,10 @@ declare module "../index" {
|
|
|
244
246
|
type PropertyPath = Many<PropertyName>;
|
|
245
247
|
/** Common interface between Arrays and jQuery objects */
|
|
246
248
|
type List<T> = ArrayLike<T>;
|
|
249
|
+
interface MutableList<T> { // Needed since ArrayLike is readonly
|
|
250
|
+
length: number;
|
|
251
|
+
[k: number]: T;
|
|
252
|
+
}
|
|
247
253
|
interface Dictionary<T> {
|
|
248
254
|
[index: string]: T;
|
|
249
255
|
}
|
|
@@ -257,6 +263,7 @@ declare module "../index" {
|
|
|
257
263
|
type PartialShallow<T> = {
|
|
258
264
|
[P in keyof T]?: T[P] extends object ? object : T[P]
|
|
259
265
|
};
|
|
266
|
+
type StringToNumber<T> = T extends `${infer N extends number}` ? N : never;
|
|
260
267
|
// For backwards compatibility
|
|
261
268
|
type LoDashImplicitArrayWrapper<T> = LoDashImplicitWrapper<T[]>;
|
|
262
269
|
type LoDashImplicitNillableArrayWrapper<T> = LoDashImplicitWrapper<T[] | null | undefined>;
|
|
@@ -358,15 +358,18 @@ declare module "../index" {
|
|
|
358
358
|
/**
|
|
359
359
|
* @see _.leading
|
|
360
360
|
*/
|
|
361
|
-
leading?: boolean;
|
|
361
|
+
leading?: boolean | undefined;
|
|
362
362
|
/**
|
|
363
363
|
* @see _.maxWait
|
|
364
364
|
*/
|
|
365
|
-
maxWait?: number;
|
|
365
|
+
maxWait?: number | undefined;
|
|
366
366
|
/**
|
|
367
367
|
* @see _.trailing
|
|
368
368
|
*/
|
|
369
|
-
trailing?: boolean;
|
|
369
|
+
trailing?: boolean | undefined;
|
|
370
|
+
}
|
|
371
|
+
interface DebounceSettingsLeading extends DebounceSettings {
|
|
372
|
+
leading: true;
|
|
370
373
|
}
|
|
371
374
|
interface DebouncedFunc<T extends (...args: any[]) => any> {
|
|
372
375
|
/**
|
|
@@ -375,25 +378,29 @@ declare module "../index" {
|
|
|
375
378
|
* If the debounced function can be run immediately, this calls it and returns its return
|
|
376
379
|
* value.
|
|
377
380
|
*
|
|
378
|
-
* Otherwise, it returns the return value of the last
|
|
381
|
+
* Otherwise, it returns the return value of the last invocation, or undefined if the debounced
|
|
379
382
|
* function was not invoked yet.
|
|
380
383
|
*/
|
|
381
384
|
(...args: Parameters<T>): ReturnType<T> | undefined;
|
|
382
385
|
|
|
383
386
|
/**
|
|
384
|
-
* Throw away any pending
|
|
387
|
+
* Throw away any pending invocation of the debounced function.
|
|
385
388
|
*/
|
|
386
389
|
cancel(): void;
|
|
387
390
|
|
|
388
391
|
/**
|
|
389
|
-
* If there is a pending
|
|
392
|
+
* If there is a pending invocation of the debounced function, invoke it immediately and return
|
|
390
393
|
* its return value.
|
|
391
394
|
*
|
|
392
|
-
* Otherwise, return the value from the last
|
|
395
|
+
* Otherwise, return the value from the last invocation, or undefined if the debounced function
|
|
393
396
|
* was never invoked.
|
|
394
397
|
*/
|
|
395
398
|
flush(): ReturnType<T> | undefined;
|
|
396
399
|
}
|
|
400
|
+
interface DebouncedFuncLeading<T extends (...args: any[]) => any> extends DebouncedFunc<T> {
|
|
401
|
+
(...args: Parameters<T>): ReturnType<T>;
|
|
402
|
+
flush(): ReturnType<T>;
|
|
403
|
+
}
|
|
397
404
|
interface LoDashStatic {
|
|
398
405
|
/**
|
|
399
406
|
* Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since
|
|
@@ -415,12 +422,17 @@ declare module "../index" {
|
|
|
415
422
|
* @param options.trailing Specify invoking on the trailing edge of the timeout.
|
|
416
423
|
* @return Returns the new debounced function.
|
|
417
424
|
*/
|
|
425
|
+
debounce<T extends (...args: any) => any>(func: T, wait: number | undefined, options: DebounceSettingsLeading): DebouncedFuncLeading<T>;
|
|
418
426
|
debounce<T extends (...args: any) => any>(func: T, wait?: number, options?: DebounceSettings): DebouncedFunc<T>;
|
|
419
427
|
}
|
|
420
428
|
interface Function<T extends (...args: any) => any> {
|
|
421
429
|
/**
|
|
422
430
|
* @see _.debounce
|
|
423
431
|
*/
|
|
432
|
+
debounce(
|
|
433
|
+
wait: number | undefined,
|
|
434
|
+
options: DebounceSettingsLeading
|
|
435
|
+
): T extends (...args: any[]) => any ? Function<DebouncedFuncLeading<T>> : never;
|
|
424
436
|
debounce(
|
|
425
437
|
wait?: number,
|
|
426
438
|
options?: DebounceSettings
|
|
@@ -430,6 +442,10 @@ declare module "../index" {
|
|
|
430
442
|
/**
|
|
431
443
|
* @see _.debounce
|
|
432
444
|
*/
|
|
445
|
+
debounce(
|
|
446
|
+
wait: number | undefined,
|
|
447
|
+
options: DebounceSettingsLeading
|
|
448
|
+
): T extends (...args: any[]) => any ? FunctionChain<DebouncedFuncLeading<T>> : never;
|
|
433
449
|
debounce(
|
|
434
450
|
wait?: number,
|
|
435
451
|
options?: DebounceSettings
|
|
@@ -639,7 +655,6 @@ declare module "../index" {
|
|
|
639
655
|
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, plc1: __, plc2: __, arg3: T3): Function3<T1, T2, T4, R>;
|
|
640
656
|
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, plc2: __, arg3: T3): Function2<T2, T4, R>;
|
|
641
657
|
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, plc1: __, arg2: T2, arg3: T3): Function2<T1, T4, R>;
|
|
642
|
-
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, arg2: T2, arg3: T3): Function1<T4, R>;
|
|
643
658
|
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, plc1: __, plc2: __, plc3: __, arg4: T4): Function3<T1, T2, T3, R>;
|
|
644
659
|
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, arg1: T1, plc2: __, plc3: __, arg4: T4): Function2<T2, T3, R>;
|
|
645
660
|
<T1, T2, T3, T4, R>(func: Function4<T1, T2, T3, T4, R>, plc1: __, arg2: T2, plc3: __, arg4: T4): Function2<T1, T3, R>;
|
|
@@ -1333,12 +1348,13 @@ declare module "../index" {
|
|
|
1333
1348
|
/**
|
|
1334
1349
|
* @see _.leading
|
|
1335
1350
|
*/
|
|
1336
|
-
leading?: boolean;
|
|
1351
|
+
leading?: boolean | undefined;
|
|
1337
1352
|
/**
|
|
1338
1353
|
* @see _.trailing
|
|
1339
1354
|
*/
|
|
1340
|
-
trailing?: boolean;
|
|
1355
|
+
trailing?: boolean | undefined;
|
|
1341
1356
|
}
|
|
1357
|
+
type ThrottleSettingsLeading = (ThrottleSettings & { leading: true }) | Omit<ThrottleSettings, 'leading'>
|
|
1342
1358
|
interface LoDashStatic {
|
|
1343
1359
|
/**
|
|
1344
1360
|
* Creates a throttled function that only invokes func at most once per every wait milliseconds. The throttled
|
|
@@ -1356,12 +1372,17 @@ declare module "../index" {
|
|
|
1356
1372
|
* @param options.trailing Specify invoking on the trailing edge of the timeout.
|
|
1357
1373
|
* @return Returns the new throttled function.
|
|
1358
1374
|
*/
|
|
1375
|
+
throttle<T extends (...args: any) => any>(func: T, wait?: number, options?: ThrottleSettingsLeading): DebouncedFuncLeading<T>;
|
|
1359
1376
|
throttle<T extends (...args: any) => any>(func: T, wait?: number, options?: ThrottleSettings): DebouncedFunc<T>;
|
|
1360
1377
|
}
|
|
1361
1378
|
interface Function<T extends (...args: any) => any> {
|
|
1362
1379
|
/**
|
|
1363
1380
|
* @see _.throttle
|
|
1364
1381
|
*/
|
|
1382
|
+
throttle(
|
|
1383
|
+
wait?: number,
|
|
1384
|
+
options?: ThrottleSettingsLeading
|
|
1385
|
+
): T extends (...args: any[]) => any ? Function<DebouncedFuncLeading<T>> : never;
|
|
1365
1386
|
throttle(
|
|
1366
1387
|
wait?: number,
|
|
1367
1388
|
options?: ThrottleSettings
|
|
@@ -1371,6 +1392,10 @@ declare module "../index" {
|
|
|
1371
1392
|
/**
|
|
1372
1393
|
* @see _.throttle
|
|
1373
1394
|
*/
|
|
1395
|
+
throttle(
|
|
1396
|
+
wait?: number,
|
|
1397
|
+
options?: ThrottleSettingsLeading
|
|
1398
|
+
): T extends (...args: any[]) => any ? FunctionChain<DebouncedFuncLeading<T>> : never;
|
|
1374
1399
|
throttle(
|
|
1375
1400
|
wait?: number,
|
|
1376
1401
|
options?: ThrottleSettings
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _ = require("../index");
|
|
2
|
-
//
|
|
2
|
+
// eslint-disable-next-line @definitelytyped/strict-export-declare-modifiers, @typescript-eslint/no-unsafe-function-type
|
|
3
3
|
type GlobalFunction = Function;
|
|
4
4
|
declare module "../index" {
|
|
5
5
|
type FunctionBase = GlobalFunction;
|
|
@@ -220,7 +220,8 @@ declare module "../index" {
|
|
|
220
220
|
*/
|
|
221
221
|
conformsTo(source: ConformsPredicateObject<TValue>): PrimitiveChain<boolean>;
|
|
222
222
|
}
|
|
223
|
-
type
|
|
223
|
+
type CondPairNullary<R> = [() => boolean, () => R];
|
|
224
|
+
type CondPairUnary<T, R> = [(val: T) => boolean, (val: T) => R];
|
|
224
225
|
interface LoDashStatic {
|
|
225
226
|
/**
|
|
226
227
|
* Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
|
@@ -560,6 +561,8 @@ declare module "../index" {
|
|
|
560
561
|
isElement(): PrimitiveChain<boolean>;
|
|
561
562
|
}
|
|
562
563
|
|
|
564
|
+
type EmptyObject<T> = { [K in keyof T]?: never };
|
|
565
|
+
type EmptyObjectOf<T> = EmptyObject<T> extends T ? EmptyObject<T> : never;
|
|
563
566
|
interface LoDashStatic {
|
|
564
567
|
/**
|
|
565
568
|
* Checks if value is empty. A value is considered empty unless it’s an arguments object, array, string, or
|
|
@@ -568,6 +571,11 @@ declare module "../index" {
|
|
|
568
571
|
* @param value The value to inspect.
|
|
569
572
|
* @return Returns true if value is empty, else false.
|
|
570
573
|
*/
|
|
574
|
+
isEmpty<T extends { __trapAny: any }>(value?: T): boolean;
|
|
575
|
+
isEmpty(value: string): value is '';
|
|
576
|
+
isEmpty(value: Map<any, any> | Set<any> | List<any> | null | undefined): boolean;
|
|
577
|
+
isEmpty(value: object): boolean;
|
|
578
|
+
isEmpty<T extends object>(value: T | null | undefined): value is EmptyObjectOf<T> | null | undefined;
|
|
571
579
|
isEmpty(value?: any): boolean;
|
|
572
580
|
}
|
|
573
581
|
interface LoDashImplicitWrapper<TValue> {
|
|
@@ -948,7 +956,7 @@ declare module "../index" {
|
|
|
948
956
|
* Checks if value is a native function.
|
|
949
957
|
* @param value The value to check.
|
|
950
958
|
*
|
|
951
|
-
* @
|
|
959
|
+
* @return Returns true if value is a native function, else false.
|
|
952
960
|
*/
|
|
953
961
|
isNative(value: any): value is (...args: any[]) => any;
|
|
954
962
|
}
|
|
@@ -101,6 +101,7 @@ declare module "../index" {
|
|
|
101
101
|
* @param array The array to iterate over.
|
|
102
102
|
* @returns Returns the maximum value.
|
|
103
103
|
*/
|
|
104
|
+
max<T>(collection: readonly [T, ...T[]]): T;
|
|
104
105
|
max<T>(collection: List<T> | null | undefined): T | undefined;
|
|
105
106
|
}
|
|
106
107
|
interface Collection<T> {
|
|
@@ -130,7 +131,7 @@ declare module "../index" {
|
|
|
130
131
|
*
|
|
131
132
|
* var objects = [{ 'n': 1 }, { 'n': 2 }];
|
|
132
133
|
*
|
|
133
|
-
* _.maxBy(objects, function(o) { return o.
|
|
134
|
+
* _.maxBy(objects, function(o) { return o.n; });
|
|
134
135
|
* // => { 'n': 2 }
|
|
135
136
|
*
|
|
136
137
|
* // using the `_.property` iteratee shorthand
|
|
@@ -216,6 +217,7 @@ declare module "../index" {
|
|
|
216
217
|
* @param array The array to iterate over.
|
|
217
218
|
* @returns Returns the minimum value.
|
|
218
219
|
*/
|
|
220
|
+
min<T>(collection: readonly [T, ...T[]]): T;
|
|
219
221
|
min<T>(collection: List<T> | null | undefined): T | undefined;
|
|
220
222
|
}
|
|
221
223
|
interface Collection<T> {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _ = require("../index");
|
|
2
|
+
import { uniqueSymbol } from "./common";
|
|
2
3
|
declare module "../index" {
|
|
3
4
|
interface LoDashStatic {
|
|
4
5
|
/**
|
|
@@ -1019,6 +1020,100 @@ declare module "../index" {
|
|
|
1019
1020
|
*/
|
|
1020
1021
|
functionsIn(): CollectionChain<string>;
|
|
1021
1022
|
}
|
|
1023
|
+
|
|
1024
|
+
type GetFieldTypeOfArrayLikeByKey<T extends unknown[], K> =
|
|
1025
|
+
K extends number ? T[K]
|
|
1026
|
+
: K extends `${infer N extends number}` ? T[N]
|
|
1027
|
+
: K extends keyof T ? T[K] : undefined;
|
|
1028
|
+
|
|
1029
|
+
type GetFieldTypeOfStringByKey<T extends string, K> =
|
|
1030
|
+
K extends number ? T[K]
|
|
1031
|
+
: K extends `${infer N extends number}` ? T[N]
|
|
1032
|
+
: K extends keyof T ? T[K]
|
|
1033
|
+
: undefined;
|
|
1034
|
+
|
|
1035
|
+
type GetFieldTypeOfNarrowedByKey<T, K> =
|
|
1036
|
+
T extends unknown[] ? GetFieldTypeOfArrayLikeByKey<T, K>
|
|
1037
|
+
: T extends string ? GetFieldTypeOfStringByKey<T, K>
|
|
1038
|
+
: K extends keyof T ? T[K]
|
|
1039
|
+
: K extends number
|
|
1040
|
+
? `${K}` extends keyof T ? T[`${K}`] : undefined
|
|
1041
|
+
: K extends `${infer N extends number}`
|
|
1042
|
+
? N extends keyof T ? T[N] : undefined
|
|
1043
|
+
: undefined;
|
|
1044
|
+
|
|
1045
|
+
/** Internal. Assumes P is a dot-delimited path. */
|
|
1046
|
+
type GetFieldTypeOfNarrowedByDotPath<T, P> =
|
|
1047
|
+
P extends `${infer L}.${infer R}`
|
|
1048
|
+
? GetFieldType<GetFieldTypeOfNarrowedByKey<T, L>, R, 'DotPath'>
|
|
1049
|
+
: GetFieldTypeOfNarrowedByKey<T, P>;
|
|
1050
|
+
|
|
1051
|
+
/** Internal. This is a piece of GetFieldTypeOfNarrowedByLKR logic,
|
|
1052
|
+
* assuming that Lc isn't to be ignored, and does not end with dot. */
|
|
1053
|
+
type GetFieldTypeOfNarrowedByLcKR<T, Lc, K, R> =
|
|
1054
|
+
'' extends R
|
|
1055
|
+
? GetFieldType<GetFieldTypeOfNarrowedByDotPath<T, Lc>, K, 'Key'>
|
|
1056
|
+
: R extends `.${infer Rc}`
|
|
1057
|
+
? GetFieldType<GetFieldType<GetFieldTypeOfNarrowedByDotPath<T, Lc>, K, 'Key'>, Rc>
|
|
1058
|
+
: GetFieldType<GetFieldType<GetFieldTypeOfNarrowedByDotPath<T, Lc>, K, 'Key'>, R>
|
|
1059
|
+
|
|
1060
|
+
/** Internal. Assumes T has been narrowed; L is a dot-delimited path,
|
|
1061
|
+
* and should be ignored if an empty string; K is a key name; and R is
|
|
1062
|
+
* a dot-delimetered path, to be ignored if an empty string. Also if
|
|
1063
|
+
* L has a tail dot, or R has a front dot, these dots should be discarded,
|
|
1064
|
+
* however when L or R is just a dot, they should be interpreted as empty
|
|
1065
|
+
* key name (rather than ignored). */
|
|
1066
|
+
type GetFieldTypeOfNarrowedByLKR<T, L, K, R> =
|
|
1067
|
+
'' extends L
|
|
1068
|
+
? '' extends R
|
|
1069
|
+
? GetFieldTypeOfNarrowedByKey<T, K>
|
|
1070
|
+
: R extends `.${infer Rc}`
|
|
1071
|
+
? GetFieldType<GetFieldTypeOfNarrowedByKey<T, K>, Rc>
|
|
1072
|
+
: GetFieldType<GetFieldTypeOfNarrowedByKey<T, K>, R>
|
|
1073
|
+
: L extends `${infer Lc}.`
|
|
1074
|
+
? GetFieldTypeOfNarrowedByLcKR<T, Lc, K, R>
|
|
1075
|
+
: GetFieldTypeOfNarrowedByLcKR<T, L, K, R>
|
|
1076
|
+
|
|
1077
|
+
/** Internal. Assumes T has been narrowed. */
|
|
1078
|
+
type GetFieldTypeOfNarrowed<T, X, XT extends 'DotPath' | 'Key' | 'Path'> =
|
|
1079
|
+
XT extends 'Key' ? GetFieldTypeOfNarrowedByKey<T, X>
|
|
1080
|
+
: XT extends 'DotPath' ? GetFieldTypeOfNarrowedByDotPath<T, X>
|
|
1081
|
+
: X extends `${infer L}['${infer K}']${infer R}`
|
|
1082
|
+
? GetFieldTypeOfNarrowedByLKR<T, L, K, R>
|
|
1083
|
+
: X extends `${infer L}["${infer K}"]${infer R}`
|
|
1084
|
+
? GetFieldTypeOfNarrowedByLKR<T, L, K, R>
|
|
1085
|
+
: X extends `${infer L}[${infer K}]${infer R}`
|
|
1086
|
+
? GetFieldTypeOfNarrowedByLKR<T, L, K, R>
|
|
1087
|
+
: GetFieldTypeOfNarrowedByDotPath<T, X>;
|
|
1088
|
+
|
|
1089
|
+
/** Internal. Assumes T has been narrowed to an object type. */
|
|
1090
|
+
type GetFieldTypeOfObject<T, X, XT extends 'DotPath' | 'Key' | 'Path'> =
|
|
1091
|
+
Extract<T, unknown[]> extends never
|
|
1092
|
+
? GetFieldTypeOfNarrowed<T, X, XT>
|
|
1093
|
+
: GetFieldTypeOfNarrowed<Exclude<T, unknown[]>, X, XT>
|
|
1094
|
+
| GetFieldTypeOfNarrowed<Extract<T, unknown[]>, X, XT>;
|
|
1095
|
+
|
|
1096
|
+
/** Internal. Assumes T has been narrowed to a primitive type. */
|
|
1097
|
+
type GetFieldTypeOfPrimitive<T, X, XT extends 'DotPath' | 'Key' | 'Path'> =
|
|
1098
|
+
Extract<T, string> extends never
|
|
1099
|
+
? T extends never ? never : undefined
|
|
1100
|
+
: (Exclude<T, string> extends never ? never : undefined)
|
|
1101
|
+
| GetFieldTypeOfNarrowed<Extract<T, string>, X, XT>;
|
|
1102
|
+
|
|
1103
|
+
/**
|
|
1104
|
+
* Deduces the type of value at the path P of type T,
|
|
1105
|
+
* so that _.get<T, P>(t: T, p: P): GetFieldType<T, P>.
|
|
1106
|
+
* XT specifies the exact meaning of X:
|
|
1107
|
+
* - 'Path' (default) - X is a path type to be fully parsed;
|
|
1108
|
+
* - 'DotPath - X is a dot-delimitered path, without square (indexing) brackets;
|
|
1109
|
+
* - 'Key' - X is a simple key, and needs no parsing.
|
|
1110
|
+
*/
|
|
1111
|
+
type GetFieldType<T, X, XT extends 'DotPath' | 'Key' | 'Path' = 'Path'> =
|
|
1112
|
+
Extract<T, object> extends never
|
|
1113
|
+
? GetFieldTypeOfPrimitive<T, X, XT>
|
|
1114
|
+
: GetFieldTypeOfPrimitive<Exclude<T, object>, X, XT>
|
|
1115
|
+
| GetFieldTypeOfObject<Extract<T, object>, X, XT>;
|
|
1116
|
+
|
|
1022
1117
|
interface LoDashStatic {
|
|
1023
1118
|
/**
|
|
1024
1119
|
* Gets the property value at path of object. If the resolved value is undefined the defaultValue is used
|
|
@@ -1045,11 +1140,11 @@ declare module "../index" {
|
|
|
1045
1140
|
/**
|
|
1046
1141
|
* @see _.get
|
|
1047
1142
|
*/
|
|
1048
|
-
get<TObject extends object, TKey1 extends keyof TObject, TKey2 extends keyof TObject[TKey1]
|
|
1143
|
+
get<TObject extends object, TKey1 extends keyof TObject, TKey2 extends keyof NonNullable<TObject[TKey1]>>(object: TObject | null | undefined, path: [TKey1, TKey2]): NonNullable<TObject[TKey1]>[TKey2] | undefined;
|
|
1049
1144
|
/**
|
|
1050
1145
|
* @see _.get
|
|
1051
1146
|
*/
|
|
1052
|
-
get<TObject extends object, TKey1 extends keyof TObject, TKey2 extends keyof TObject[TKey1]
|
|
1147
|
+
get<TObject extends object, TKey1 extends keyof TObject, TKey2 extends keyof NonNullable<TObject[TKey1]>, TDefault>(object: TObject | null | undefined, path: [TKey1, TKey2], defaultValue: TDefault): Exclude<NonNullable<TObject[TKey1]>[TKey2], undefined> | TDefault;
|
|
1053
1148
|
/**
|
|
1054
1149
|
* @see _.get
|
|
1055
1150
|
*/
|
|
@@ -1057,11 +1152,11 @@ declare module "../index" {
|
|
|
1057
1152
|
/**
|
|
1058
1153
|
* @see _.get
|
|
1059
1154
|
*/
|
|
1060
|
-
get<TObject extends object, TKey1 extends keyof TObject, TKey2 extends keyof TObject[TKey1]
|
|
1155
|
+
get<TObject extends object, TKey1 extends keyof TObject, TKey2 extends keyof NonNullable<TObject[TKey1]>, TKey3 extends keyof NonNullable<NonNullable<TObject[TKey1]>[TKey2]>>(object: TObject | null | undefined, path: [TKey1, TKey2, TKey3]): NonNullable<NonNullable<TObject[TKey1]>[TKey2]>[TKey3] | undefined;
|
|
1061
1156
|
/**
|
|
1062
1157
|
* @see _.get
|
|
1063
1158
|
*/
|
|
1064
|
-
get<TObject extends object, TKey1 extends keyof TObject, TKey2 extends keyof TObject[TKey1]
|
|
1159
|
+
get<TObject extends object, TKey1 extends keyof TObject, TKey2 extends keyof NonNullable<TObject[TKey1]>, TKey3 extends keyof NonNullable<NonNullable<TObject[TKey1]>[TKey2]>, TDefault>(object: TObject | null | undefined, path: [TKey1, TKey2, TKey3], defaultValue: TDefault): Exclude<NonNullable<NonNullable<TObject[TKey1]>[TKey2]>[TKey3], undefined> | TDefault;
|
|
1065
1160
|
/**
|
|
1066
1161
|
* @see _.get
|
|
1067
1162
|
*/
|
|
@@ -1069,11 +1164,11 @@ declare module "../index" {
|
|
|
1069
1164
|
/**
|
|
1070
1165
|
* @see _.get
|
|
1071
1166
|
*/
|
|
1072
|
-
get<TObject extends object, TKey1 extends keyof TObject, TKey2 extends keyof TObject[TKey1]
|
|
1167
|
+
get<TObject extends object, TKey1 extends keyof TObject, TKey2 extends keyof NonNullable<TObject[TKey1]>, TKey3 extends keyof NonNullable<NonNullable<TObject[TKey1]>[TKey2]>, TKey4 extends keyof NonNullable<NonNullable<NonNullable<TObject[TKey1]>[TKey2]>[TKey3]>>(object: TObject | null | undefined, path: [TKey1, TKey2, TKey3, TKey4]): NonNullable<NonNullable<NonNullable<TObject[TKey1]>[TKey2]>[TKey3]>[TKey4] | undefined;
|
|
1073
1168
|
/**
|
|
1074
1169
|
* @see _.get
|
|
1075
1170
|
*/
|
|
1076
|
-
get<TObject extends object, TKey1 extends keyof TObject, TKey2 extends keyof TObject[TKey1]
|
|
1171
|
+
get<TObject extends object, TKey1 extends keyof TObject, TKey2 extends keyof NonNullable<TObject[TKey1]>, TKey3 extends keyof NonNullable<NonNullable<TObject[TKey1]>[TKey2]>, TKey4 extends keyof NonNullable<NonNullable<NonNullable<TObject[TKey1]>[TKey2]>[TKey3]>, TDefault>(object: TObject | null | undefined, path: [TKey1, TKey2, TKey3, TKey4], defaultValue: TDefault): Exclude<NonNullable<NonNullable<NonNullable<TObject[TKey1]>[TKey2]>[TKey3]>[TKey4], undefined> | TDefault;
|
|
1077
1172
|
/**
|
|
1078
1173
|
* @see _.get
|
|
1079
1174
|
*/
|
|
@@ -1097,7 +1192,15 @@ declare module "../index" {
|
|
|
1097
1192
|
/**
|
|
1098
1193
|
* @see _.get
|
|
1099
1194
|
*/
|
|
1100
|
-
get(
|
|
1195
|
+
get<TObject, TPath extends string>(data: TObject, path: TPath): string extends TPath ? any : GetFieldType<TObject, TPath>;
|
|
1196
|
+
/**
|
|
1197
|
+
* @see _.get
|
|
1198
|
+
*/
|
|
1199
|
+
get<TObject, TPath extends string, TDefault = GetFieldType<TObject, TPath>>(data: TObject, path: TPath, defaultValue: TDefault): Exclude<GetFieldType<TObject, TPath>, null | undefined> | TDefault;
|
|
1200
|
+
/**
|
|
1201
|
+
* @see _.get
|
|
1202
|
+
*/
|
|
1203
|
+
get(object: any, path: PropertyPath, defaultValue?: any): any;
|
|
1101
1204
|
}
|
|
1102
1205
|
interface String {
|
|
1103
1206
|
/**
|
|
@@ -1142,6 +1245,14 @@ declare module "../index" {
|
|
|
1142
1245
|
* @see _.get
|
|
1143
1246
|
*/
|
|
1144
1247
|
get<TKey1 extends keyof T, TKey2 extends keyof T[TKey1], TKey3 extends keyof T[TKey1][TKey2], TKey4 extends keyof T[TKey1][TKey2][TKey3], TDefault>(path: [TKey1, TKey2, TKey3, TKey4], defaultValue: TDefault): Exclude<T[TKey1][TKey2][TKey3][TKey4], undefined> | TDefault;
|
|
1248
|
+
/**
|
|
1249
|
+
* @see _.get
|
|
1250
|
+
*/
|
|
1251
|
+
get<TPath extends string>(path: TPath): string extends TPath ? any : GetFieldType<T, TPath>;
|
|
1252
|
+
/**
|
|
1253
|
+
* @see _.get
|
|
1254
|
+
*/
|
|
1255
|
+
get<TPath extends string, TDefault = GetFieldType<T, TPath>>(path: TPath, defaultValue: TDefault): Exclude<GetFieldType<T, TPath>, null | undefined> | TDefault;
|
|
1145
1256
|
/**
|
|
1146
1257
|
* @see _.get
|
|
1147
1258
|
*/
|
|
@@ -1226,6 +1337,14 @@ declare module "../index" {
|
|
|
1226
1337
|
* @see _.get
|
|
1227
1338
|
*/
|
|
1228
1339
|
get<TKey1 extends keyof T, TKey2 extends keyof T[TKey1], TKey3 extends keyof T[TKey1][TKey2], TKey4 extends keyof T[TKey1][TKey2][TKey3], TDefault>(path: [TKey1, TKey2, TKey3, TKey4], defaultValue: TDefault): ExpChain<Exclude<T[TKey1][TKey2][TKey3][TKey4], undefined> | TDefault>;
|
|
1340
|
+
/**
|
|
1341
|
+
* @see _.get
|
|
1342
|
+
*/
|
|
1343
|
+
get<TPath extends string>(path: TPath): string extends TPath ? LoDashExplicitWrapper<any> : ExpChain<GetFieldType<T, TPath>>;
|
|
1344
|
+
/**
|
|
1345
|
+
* @see _.get
|
|
1346
|
+
*/
|
|
1347
|
+
get<TPath extends string, TDefault = GetFieldType<T, TPath>>(path: TPath, defaultValue: TDefault): ExpChain<Exclude<GetFieldType<T, TPath>, null | undefined> | TDefault>;
|
|
1229
1348
|
/**
|
|
1230
1349
|
* @see _.get
|
|
1231
1350
|
*/
|
|
@@ -1266,6 +1385,7 @@ declare module "../index" {
|
|
|
1266
1385
|
* _.has(other, 'a');
|
|
1267
1386
|
* // => false
|
|
1268
1387
|
*/
|
|
1388
|
+
has<T, K extends PropertyName>(object: T, path: K): object is T & { [P in K]: P extends keyof T ? T[P] : Record<string, unknown> extends T ? T[keyof T] : unknown} & {[uniqueSymbol]: unknown};
|
|
1269
1389
|
has<T>(object: T, path: PropertyPath): boolean;
|
|
1270
1390
|
}
|
|
1271
1391
|
interface LoDashImplicitWrapper<TValue> {
|
|
@@ -1516,6 +1636,10 @@ declare module "../index" {
|
|
|
1516
1636
|
* @return Returns the new mapped object.
|
|
1517
1637
|
*/
|
|
1518
1638
|
mapValues<TResult>(obj: string | null | undefined, callback: StringIterator<TResult>): NumericDictionary<TResult>;
|
|
1639
|
+
/**
|
|
1640
|
+
* @see _.mapValues
|
|
1641
|
+
*/
|
|
1642
|
+
mapValues<T, TResult>(array: T[], callback: ArrayIterator<T, TResult>): NumericDictionary<TResult>;
|
|
1519
1643
|
/**
|
|
1520
1644
|
* @see _.mapValues
|
|
1521
1645
|
*/
|
|
@@ -1571,7 +1695,7 @@ declare module "../index" {
|
|
|
1571
1695
|
/**
|
|
1572
1696
|
* @see _.mapValues
|
|
1573
1697
|
*/
|
|
1574
|
-
mapValues<TResult>(callback:
|
|
1698
|
+
mapValues<TResult>(callback: ArrayIterator<T, TResult>): NumericDictionary<TResult>;
|
|
1575
1699
|
/**
|
|
1576
1700
|
* @see _.mapValues
|
|
1577
1701
|
*/
|
|
@@ -1639,7 +1763,7 @@ declare module "../index" {
|
|
|
1639
1763
|
/**
|
|
1640
1764
|
* @see _.mapValues
|
|
1641
1765
|
*/
|
|
1642
|
-
mapValues<TResult>(callback:
|
|
1766
|
+
mapValues<TResult>(callback: ArrayIterator<T, TResult>): ObjectChain<NumericDictionary<TResult>>;
|
|
1643
1767
|
/**
|
|
1644
1768
|
* @see _.mapValues
|
|
1645
1769
|
*/
|
|
@@ -1696,7 +1820,7 @@ declare module "../index" {
|
|
|
1696
1820
|
*
|
|
1697
1821
|
* @category Object
|
|
1698
1822
|
* @param object The destination object.
|
|
1699
|
-
* @param [
|
|
1823
|
+
* @param [source] The source objects.
|
|
1700
1824
|
* @returns Returns `object`.
|
|
1701
1825
|
* @example
|
|
1702
1826
|
*
|
|
@@ -1773,7 +1897,7 @@ declare module "../index" {
|
|
|
1773
1897
|
*/
|
|
1774
1898
|
merge(...otherArgs: any[]): ObjectChain<any>;
|
|
1775
1899
|
}
|
|
1776
|
-
type MergeWithCustomizer = { bivariantHack(value: any, srcValue: any, key: string, object: any, source: any): any; }["bivariantHack"];
|
|
1900
|
+
type MergeWithCustomizer = { bivariantHack(value: any, srcValue: any, key: string, object: any, source: any, stack: any): any; }["bivariantHack"];
|
|
1777
1901
|
// TODO: Probably should just put all these methods on Object and forget about it.
|
|
1778
1902
|
// oh, except for Collection<any> I GUESS
|
|
1779
1903
|
interface LoDashStatic {
|
|
@@ -1781,12 +1905,12 @@ declare module "../index" {
|
|
|
1781
1905
|
* This method is like `_.merge` except that it accepts `customizer` which
|
|
1782
1906
|
* is invoked to produce the merged values of the destination and source
|
|
1783
1907
|
* properties. If `customizer` returns `undefined` merging is handled by the
|
|
1784
|
-
* method instead. The `customizer` is invoked with
|
|
1908
|
+
* method instead. The `customizer` is invoked with six arguments:
|
|
1785
1909
|
* (objValue, srcValue, key, object, source, stack).
|
|
1786
1910
|
*
|
|
1787
1911
|
* @category Object
|
|
1788
1912
|
* @param object The destination object.
|
|
1789
|
-
* @param
|
|
1913
|
+
* @param source The source objects.
|
|
1790
1914
|
* @param customizer The function to customize assigned values.
|
|
1791
1915
|
* @returns Returns `object`.
|
|
1792
1916
|
* @example
|
|
@@ -1807,7 +1931,7 @@ declare module "../index" {
|
|
|
1807
1931
|
* 'vegetables': ['carrot']
|
|
1808
1932
|
* };
|
|
1809
1933
|
*
|
|
1810
|
-
* _.
|
|
1934
|
+
* _.mergeWith(object, other, customizer);
|
|
1811
1935
|
* // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }
|
|
1812
1936
|
*/
|
|
1813
1937
|
mergeWith<TObject, TSource>(object: TObject, source: TSource, customizer: MergeWithCustomizer): TObject & TSource;
|
|
@@ -2005,7 +2129,7 @@ declare module "../index" {
|
|
|
2005
2129
|
/**
|
|
2006
2130
|
* @see _.pick
|
|
2007
2131
|
*/
|
|
2008
|
-
pick<T>(object: T | null | undefined, ...props: PropertyPath
|
|
2132
|
+
pick<T>(object: T | null | undefined, ...props: Array<Many<PropertyPath>>): PartialObject<T>;
|
|
2009
2133
|
}
|
|
2010
2134
|
interface Object<T> {
|
|
2011
2135
|
/**
|
|
@@ -2015,7 +2139,7 @@ declare module "../index" {
|
|
|
2015
2139
|
/**
|
|
2016
2140
|
* @see _.pick
|
|
2017
2141
|
*/
|
|
2018
|
-
pick(...props: PropertyPath
|
|
2142
|
+
pick(...props: Array<Many<PropertyPath>>): Object<PartialObject<T>>;
|
|
2019
2143
|
}
|
|
2020
2144
|
interface ObjectChain<T> {
|
|
2021
2145
|
/**
|
|
@@ -2025,7 +2149,7 @@ declare module "../index" {
|
|
|
2025
2149
|
/**
|
|
2026
2150
|
* @see _.pick
|
|
2027
2151
|
*/
|
|
2028
|
-
pick(...props: PropertyPath
|
|
2152
|
+
pick(...props: Array<Many<PropertyPath>>): ObjectChain<PartialObject<T>>;
|
|
2029
2153
|
}
|
|
2030
2154
|
interface LoDashStatic {
|
|
2031
2155
|
/**
|
|
@@ -2079,7 +2203,7 @@ declare module "../index" {
|
|
|
2079
2203
|
/**
|
|
2080
2204
|
* @see _.pickBy
|
|
2081
2205
|
*/
|
|
2082
|
-
pickBy(predicate?: ValueKeyIteratee<T[keyof T]>): Object<PartialObject<T>>;
|
|
2206
|
+
pickBy(predicate?: ValueKeyIteratee<T[keyof T]>): Object<T extends Dictionary<unknown> ? Dictionary<T[keyof T]> : T extends NumericDictionary<unknown> ? NumericDictionary<T[keyof T]> : PartialObject<T>>;
|
|
2083
2207
|
}
|
|
2084
2208
|
interface CollectionChain<T> {
|
|
2085
2209
|
/**
|
|
@@ -2099,7 +2223,7 @@ declare module "../index" {
|
|
|
2099
2223
|
/**
|
|
2100
2224
|
* @see _.pickBy
|
|
2101
2225
|
*/
|
|
2102
|
-
pickBy(predicate?: ValueKeyIteratee<T[keyof T]>): ObjectChain<PartialObject<T>>;
|
|
2226
|
+
pickBy(predicate?: ValueKeyIteratee<T[keyof T]>): ObjectChain<T extends Dictionary<unknown> ? Dictionary<T[keyof T]> : T extends NumericDictionary<unknown> ? NumericDictionary<T[keyof T]> : PartialObject<T>>;
|
|
2103
2227
|
}
|
|
2104
2228
|
interface LoDashStatic {
|
|
2105
2229
|
/**
|
|
@@ -2263,7 +2387,7 @@ declare module "../index" {
|
|
|
2263
2387
|
* @param accumulator The custom accumulator value.
|
|
2264
2388
|
* @return Returns the accumulated value.
|
|
2265
2389
|
*/
|
|
2266
|
-
transform<T, TResult>(object:
|
|
2390
|
+
transform<T, TResult>(object: readonly T[], iteratee: MemoVoidArrayIterator<T, TResult>, accumulator?: TResult): TResult;
|
|
2267
2391
|
/**
|
|
2268
2392
|
* @see _.transform
|
|
2269
2393
|
*/
|