@types/lodash 4.17.19 → 4.17.21

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: Sat, 22 Nov 2025 15:33:02 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
  /**
@@ -841,6 +849,7 @@ declare module "../index" {
841
849
  * @param array The array to query.
842
850
  * @return Returns the last element of array.
843
851
  */
852
+ last<T>(array: readonly [...unknown[], T]): T;
844
853
  last<T>(array: List<T> | null | undefined): T | undefined;
845
854
  }
846
855
  interface Collection<T> {
@@ -932,7 +941,7 @@ declare module "../index" {
932
941
  /**
933
942
  * @see _.pull
934
943
  */
935
- pull<T>(array: List<T>, ...values: T[]): List<T>;
944
+ pull<TList extends MutableList<any>>(array: RejectReadonly<TList>, ...values: TList[0][]): TList;
936
945
  }
937
946
  interface Collection<T> {
938
947
  /**
@@ -968,7 +977,7 @@ declare module "../index" {
968
977
  /**
969
978
  * @see _.pullAll
970
979
  */
971
- pullAll<T>(array: List<T>, values?: List<T>): List<T>;
980
+ pullAll<TList extends MutableList<any>>(array: RejectReadonly<TList>, values?: List<TList[0]>): TList;
972
981
  }
973
982
  interface Collection<T> {
974
983
  /**
@@ -1007,7 +1016,7 @@ declare module "../index" {
1007
1016
  /**
1008
1017
  * @see _.pullAllBy
1009
1018
  */
1010
- pullAllBy<T>(array: List<T>, values?: List<T>, iteratee?: ValueIteratee<T>): List<T>;
1019
+ pullAllBy<TList extends MutableList<any>>(array: RejectReadonly<TList>, values?: List<TList[0]>, iteratee?: ValueIteratee<TList[0]>): TList;
1011
1020
  /**
1012
1021
  * @see _.pullAllBy
1013
1022
  */
@@ -1015,7 +1024,7 @@ declare module "../index" {
1015
1024
  /**
1016
1025
  * @see _.pullAllBy
1017
1026
  */
1018
- pullAllBy<T1, T2>(array: List<T1>, values: List<T2>, iteratee: ValueIteratee<T1 | T2>): List<T1>;
1027
+ pullAllBy<T1List extends MutableList<any>, T2>(array: RejectReadonly<T1List>, values: List<T2>, iteratee: ValueIteratee<T1List[0] | T2>): T1List;
1019
1028
  }
1020
1029
  interface Collection<T> {
1021
1030
  /**
@@ -1054,7 +1063,7 @@ declare module "../index" {
1054
1063
  /**
1055
1064
  * @see _.pullAllWith
1056
1065
  */
1057
- pullAllWith<T>(array: List<T>, values?: List<T>, comparator?: Comparator<T>): List<T>;
1066
+ pullAllWith<TList extends MutableList<any>>(array: RejectReadonly<TList>, values?: List<TList[0]>, comparator?: Comparator<TList[0]>): TList;
1058
1067
  /**
1059
1068
  * @see _.pullAllWith
1060
1069
  */
@@ -1062,7 +1071,7 @@ declare module "../index" {
1062
1071
  /**
1063
1072
  * @see _.pullAllWith
1064
1073
  */
1065
- pullAllWith<T1, T2>(array: List<T1>, values: List<T2>, comparator: Comparator2<T1, T2>): List<T1>;
1074
+ pullAllWith<T1List extends MutableList<any>, T2>(array: RejectReadonly<T1List>, values: List<T2>, comparator: Comparator2<T1List[0], T2>): T1List;
1066
1075
  }
1067
1076
  interface Collection<T> {
1068
1077
  /**
@@ -1091,7 +1100,7 @@ declare module "../index" {
1091
1100
  /**
1092
1101
  * @see _.pullAt
1093
1102
  */
1094
- pullAt<T>(array: List<T>, ...indexes: Array<Many<number>>): List<T>;
1103
+ pullAt<TList extends MutableList<any>>(array: RejectReadonly<TList>, ...indexes: Array<Many<number>>): TList;
1095
1104
  }
1096
1105
  interface Collection<T> {
1097
1106
  /**
@@ -1116,7 +1125,7 @@ declare module "../index" {
1116
1125
  * @param predicate The function invoked per iteration.
1117
1126
  * @return Returns the new array of removed elements.
1118
1127
  */
1119
- remove<T>(array: List<T>, predicate?: ListIteratee<T>): T[];
1128
+ remove<TList extends MutableList<any>>(array: RejectReadonly<TList>, predicate?: ListIteratee<TList[0]>): TList[0][];
1120
1129
  }
1121
1130
  interface Collection<T> {
1122
1131
  /**
@@ -1150,7 +1159,7 @@ declare module "../index" {
1150
1159
  * console.log(array);
1151
1160
  * // => [3, 2, 1]
1152
1161
  */
1153
- reverse<TList extends List<any>>(array: TList): TList;
1162
+ reverse<TList extends MutableList<any>>(array: RejectReadonly<TList>): TList;
1154
1163
  }
1155
1164
  interface LoDashStatic {
1156
1165
  /**
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/common/math.d.ts CHANGED
@@ -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> {
@@ -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> {
lodash/fp.d.ts CHANGED
@@ -1169,7 +1169,10 @@ declare namespace _ {
1169
1169
  }
1170
1170
  type LodashFindLastKey1x1<T> = (object: object | null | undefined) => string | undefined;
1171
1171
  type LodashFindLastKey1x2<T> = (predicate: lodash.ValueIteratee<T[keyof T]>) => string | undefined;
1172
- type LodashHead = <T>(array: lodash.List<T> | null | undefined) => T | undefined;
1172
+ interface LodashHead {
1173
+ <T>(array: readonly [T, ...unknown[]]): T;
1174
+ <T>(array: lodash.List<T> | null | undefined): T | undefined;
1175
+ }
1173
1176
  interface LodashFlatMap {
1174
1177
  <T, TResult>(iteratee: (value: T) => lodash.Many<TResult>): LodashFlatMap1x1<T, TResult>;
1175
1178
  <T>(iteratee: lodash.__, collection: lodash.List<T> | null | undefined): LodashFlatMap1x2<T>;
@@ -2030,7 +2033,10 @@ declare namespace _ {
2030
2033
  type LodashKebabCase = (string: string) => string;
2031
2034
  type LodashKeys = (object: any) => string[];
2032
2035
  type LodashKeysIn = (object: any) => string[];
2033
- type LodashLast = <T>(array: lodash.List<T> | null | undefined) => T | undefined;
2036
+ interface LodashLast {
2037
+ <T>(array: readonly [...unknown[], T]): T;
2038
+ <T>(array: lodash.List<T> | null | undefined): T | undefined;
2039
+ }
2034
2040
  interface LodashLastIndexOf {
2035
2041
  <T>(value: T): LodashLastIndexOf1x1<T>;
2036
2042
  <T>(value: lodash.__, array: lodash.List<T> | null | undefined): LodashLastIndexOf1x2<T>;
@@ -2167,7 +2173,10 @@ declare namespace _ {
2167
2173
  }
2168
2174
  type LodashMatchesProperty1x1 = <T>(srcValue: T) => (value: any) => boolean;
2169
2175
  type LodashMatchesProperty1x2 = (path: lodash.PropertyPath) => (value: any) => boolean;
2170
- type LodashMax = <T>(collection: lodash.List<T> | null | undefined) => T | undefined;
2176
+ interface LodashMax {
2177
+ <T>(collection: readonly [T, ...T[]]): T;
2178
+ <T>(collection: lodash.List<T> | null | undefined): T | undefined;
2179
+ }
2171
2180
  interface LodashMaxBy {
2172
2181
  <T>(iteratee: lodash.ValueIteratee<T>): LodashMaxBy1x1<T>;
2173
2182
  <T>(iteratee: lodash.__, collection: lodash.List<T> | null | undefined): LodashMaxBy1x2<T>;
@@ -2234,7 +2243,10 @@ declare namespace _ {
2234
2243
  type LodashMergeWith1x6<TObject, TSource> = (customizer: lodash.MergeWithCustomizer) => TObject & TSource;
2235
2244
  type LodashMethod = (path: lodash.PropertyPath) => (object: any) => any;
2236
2245
  type LodashMethodOf = (object: object) => (path: lodash.PropertyPath) => any;
2237
- type LodashMin = <T>(collection: lodash.List<T> | null | undefined) => T | undefined;
2246
+ interface LodashMin {
2247
+ <T>(collection: readonly [T, ...T[]]): T;
2248
+ <T>(collection: lodash.List<T> | null | undefined): T | undefined;
2249
+ }
2238
2250
  interface LodashMinBy {
2239
2251
  <T>(iteratee: lodash.ValueIteratee<T>): LodashMinBy1x1<T>;
2240
2252
  <T>(iteratee: lodash.__, collection: lodash.List<T> | null | undefined): LodashMinBy1x2<T>;
lodash/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/lodash",
3
- "version": "4.17.19",
3
+ "version": "4.17.21",
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",
55
- "typeScriptVersion": "5.1"
54
+ "typesPublisherContentHash": "262ec0cf23acf06f09c8d1c50a22c7fb7947e11fcaefe36187c657c5f438e04c",
55
+ "typeScriptVersion": "5.2"
56
56
  }