@types/lodash 4.17.19 → 4.17.20

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.
lodash/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for lodash (https://lodash.com).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/lodash.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Wed, 25 Jun 2025 22:36:35 GMT
11
+ * Last updated: Tue, 01 Jul 2025 20:02:28 GMT
12
12
  * Dependencies: none
13
13
 
14
14
  # Credits
lodash/common/array.d.ts CHANGED
@@ -1,4 +1,12 @@
1
1
  import _ = require("../index");
2
+
3
+ // Helper types to reject readonly arrays
4
+ type _Eq<T, U> = (<X>() => X extends T ? 1 : 2) extends (<X>() => X extends U ? 1 : 2) ? true : false
5
+ type _IsWritable<T> = _Eq<{ [K in keyof T]: T[K] }, { -readonly [K in keyof T]: T[K] }>
6
+ type RejectReadonly<T extends _.MutableList<unknown>> = _IsWritable<T> extends true ? T : never
7
+
8
+ export {}
9
+
2
10
  declare module "../index" {
3
11
  interface LoDashStatic {
4
12
  /**
@@ -342,7 +350,7 @@ declare module "../index" {
342
350
  /**
343
351
  * @see _.fill
344
352
  */
345
- fill<T>(array: List<any> | null | undefined, value: T): List<T>;
353
+ fill<T, AnyList extends MutableList<any>>(array: RejectReadonly<AnyList> | null | undefined, value: T): List<T>;
346
354
  /**
347
355
  * @see _.fill
348
356
  */
@@ -350,7 +358,7 @@ declare module "../index" {
350
358
  /**
351
359
  * @see _.fill
352
360
  */
353
- fill<T, U>(array: List<U> | null | undefined, value: T, start?: number, end?: number): List<T | U>;
361
+ fill<T, UList extends MutableList<any>>(array: RejectReadonly<UList> | null | undefined, value: T, start?: number, end?: number): List<T | UList[0]>;
354
362
  }
355
363
  interface Collection<T> {
356
364
  /**
@@ -932,7 +940,7 @@ declare module "../index" {
932
940
  /**
933
941
  * @see _.pull
934
942
  */
935
- pull<T>(array: List<T>, ...values: T[]): List<T>;
943
+ pull<TList extends MutableList<any>>(array: RejectReadonly<TList>, ...values: TList[0][]): TList;
936
944
  }
937
945
  interface Collection<T> {
938
946
  /**
@@ -968,7 +976,7 @@ declare module "../index" {
968
976
  /**
969
977
  * @see _.pullAll
970
978
  */
971
- pullAll<T>(array: List<T>, values?: List<T>): List<T>;
979
+ pullAll<TList extends MutableList<any>>(array: RejectReadonly<TList>, values?: List<TList[0]>): TList;
972
980
  }
973
981
  interface Collection<T> {
974
982
  /**
@@ -1007,7 +1015,7 @@ declare module "../index" {
1007
1015
  /**
1008
1016
  * @see _.pullAllBy
1009
1017
  */
1010
- pullAllBy<T>(array: List<T>, values?: List<T>, iteratee?: ValueIteratee<T>): List<T>;
1018
+ pullAllBy<TList extends MutableList<any>>(array: RejectReadonly<TList>, values?: List<TList[0]>, iteratee?: ValueIteratee<TList[0]>): TList;
1011
1019
  /**
1012
1020
  * @see _.pullAllBy
1013
1021
  */
@@ -1015,7 +1023,7 @@ declare module "../index" {
1015
1023
  /**
1016
1024
  * @see _.pullAllBy
1017
1025
  */
1018
- pullAllBy<T1, T2>(array: List<T1>, values: List<T2>, iteratee: ValueIteratee<T1 | T2>): List<T1>;
1026
+ pullAllBy<T1List extends MutableList<any>, T2>(array: RejectReadonly<T1List>, values: List<T2>, iteratee: ValueIteratee<T1List[0] | T2>): T1List;
1019
1027
  }
1020
1028
  interface Collection<T> {
1021
1029
  /**
@@ -1054,7 +1062,7 @@ declare module "../index" {
1054
1062
  /**
1055
1063
  * @see _.pullAllWith
1056
1064
  */
1057
- pullAllWith<T>(array: List<T>, values?: List<T>, comparator?: Comparator<T>): List<T>;
1065
+ pullAllWith<TList extends MutableList<any>>(array: RejectReadonly<TList>, values?: List<TList[0]>, comparator?: Comparator<TList[0]>): TList;
1058
1066
  /**
1059
1067
  * @see _.pullAllWith
1060
1068
  */
@@ -1062,7 +1070,7 @@ declare module "../index" {
1062
1070
  /**
1063
1071
  * @see _.pullAllWith
1064
1072
  */
1065
- pullAllWith<T1, T2>(array: List<T1>, values: List<T2>, comparator: Comparator2<T1, T2>): List<T1>;
1073
+ pullAllWith<T1List extends MutableList<any>, T2>(array: RejectReadonly<T1List>, values: List<T2>, comparator: Comparator2<T1List[0], T2>): T1List;
1066
1074
  }
1067
1075
  interface Collection<T> {
1068
1076
  /**
@@ -1091,7 +1099,7 @@ declare module "../index" {
1091
1099
  /**
1092
1100
  * @see _.pullAt
1093
1101
  */
1094
- pullAt<T>(array: List<T>, ...indexes: Array<Many<number>>): List<T>;
1102
+ pullAt<TList extends MutableList<any>>(array: RejectReadonly<TList>, ...indexes: Array<Many<number>>): TList;
1095
1103
  }
1096
1104
  interface Collection<T> {
1097
1105
  /**
@@ -1116,7 +1124,7 @@ declare module "../index" {
1116
1124
  * @param predicate The function invoked per iteration.
1117
1125
  * @return Returns the new array of removed elements.
1118
1126
  */
1119
- remove<T>(array: List<T>, predicate?: ListIteratee<T>): T[];
1127
+ remove<TList extends MutableList<any>>(array: RejectReadonly<TList>, predicate?: ListIteratee<TList[0]>): TList[0][];
1120
1128
  }
1121
1129
  interface Collection<T> {
1122
1130
  /**
@@ -1150,7 +1158,7 @@ declare module "../index" {
1150
1158
  * console.log(array);
1151
1159
  * // => [3, 2, 1]
1152
1160
  */
1153
- reverse<TList extends List<any>>(array: TList): TList;
1161
+ reverse<TList extends MutableList<any>>(array: RejectReadonly<TList>): TList;
1154
1162
  }
1155
1163
  interface LoDashStatic {
1156
1164
  /**
lodash/common/common.d.ts CHANGED
@@ -246,6 +246,10 @@ declare module "../index" {
246
246
  type PropertyPath = Many<PropertyName>;
247
247
  /** Common interface between Arrays and jQuery objects */
248
248
  type List<T> = ArrayLike<T>;
249
+ interface MutableList<T> { // Needed since ArrayLike is readonly
250
+ length: number;
251
+ [k: number]: T;
252
+ }
249
253
  interface Dictionary<T> {
250
254
  [index: string]: T;
251
255
  }
lodash/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/lodash",
3
- "version": "4.17.19",
3
+ "version": "4.17.20",
4
4
  "description": "TypeScript definitions for lodash",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/lodash",
6
6
  "license": "MIT",
@@ -51,6 +51,6 @@
51
51
  "scripts": {},
52
52
  "dependencies": {},
53
53
  "peerDependencies": {},
54
- "typesPublisherContentHash": "81ab89b6410e58e49431522c43180d313e8d933b3579861c67939db949594e82",
54
+ "typesPublisherContentHash": "965f926f13027c7e00359bf3899ec168b333c7e871110fa4d25af188bdcf5f08",
55
55
  "typeScriptVersion": "5.1"
56
56
  }