@oscarpalmer/atoms 0.77.2 → 0.77.3

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/types/index.d.cts CHANGED
@@ -1857,7 +1857,10 @@ export declare function find<
1857
1857
  export declare function groupBy<
1858
1858
  Item extends PlainObject,
1859
1859
  ItemKey extends keyof Item,
1860
- >(array: Item[], key: ItemKey): Record<KeyedValue<Item, ItemKey>, Item>;
1860
+ >(
1861
+ array: Item[],
1862
+ key: ItemKey,
1863
+ ): Simplify<Record<KeyedValue<Item, ItemKey>, Item>>;
1861
1864
  /**
1862
1865
  * Create a record from an array of items using a specific key, and grouping them into arrays
1863
1866
  */
@@ -1868,7 +1871,7 @@ export declare function groupBy<
1868
1871
  array: Item[],
1869
1872
  key: ItemKey,
1870
1873
  arrays: true,
1871
- ): Record<KeyedValue<Item, ItemKey>, Item[]>;
1874
+ ): Simplify<Record<KeyedValue<Item, ItemKey>, Item[]>>;
1872
1875
  /**
1873
1876
  * Create a record from an array of items using a specific key
1874
1877
  */
@@ -1898,7 +1901,7 @@ export declare function groupBy<
1898
1901
  array: Item[],
1899
1902
  key: ItemKey,
1900
1903
  value: ItemValue,
1901
- ): Record<KeyedValue<Item, ItemKey>, KeyedValue<Item, ItemValue>>;
1904
+ ): Simplify<Record<KeyedValue<Item, ItemKey>, Item[ItemValue]>>;
1902
1905
  /**
1903
1906
  * Create a record from an array of items using a specific key and value, and grouping them into arrays
1904
1907
  */
@@ -1911,7 +1914,7 @@ export declare function groupBy<
1911
1914
  key: ItemKey,
1912
1915
  value: ItemValue,
1913
1916
  arrays: true,
1914
- ): Record<KeyedValue<Item, ItemKey>, Array<KeyedValue<Item, ItemValue>>>;
1917
+ ): Simplify<Record<KeyedValue<Item, ItemKey>, Array<Item[ItemValue]>>>;
1915
1918
  /**
1916
1919
  * Create a record from an array of items using a specific key and value
1917
1920
  */
@@ -1923,7 +1926,7 @@ export declare function groupBy<
1923
1926
  array: Item[],
1924
1927
  key: ItemKey,
1925
1928
  value: ItemValue,
1926
- ): Record<KeyedValue<Item, ItemKey>, ReturnType<ItemValue>>;
1929
+ ): Simplify<Record<KeyedValue<Item, ItemKey>, ReturnType<ItemValue>>>;
1927
1930
  /**
1928
1931
  * Create a record from an array of items using a specific key and value, and grouping them into arrays
1929
1932
  */
@@ -1936,7 +1939,7 @@ export declare function groupBy<
1936
1939
  key: ItemKey,
1937
1940
  value: ItemValue,
1938
1941
  arrays: true,
1939
- ): Record<KeyedValue<Item, ItemKey>, Array<ReturnType<ItemValue>>>;
1942
+ ): Simplify<Record<KeyedValue<Item, ItemKey>, Array<ReturnType<ItemValue>>>>;
1940
1943
  /**
1941
1944
  * Create a record from an array of items using a specific key and value
1942
1945
  */
@@ -1948,7 +1951,7 @@ export declare function groupBy<
1948
1951
  array: Item[],
1949
1952
  key: ItemKey,
1950
1953
  value: ItemValue,
1951
- ): Record<ReturnType<ItemKey>, KeyedValue<Item, ItemValue>>;
1954
+ ): Record<ReturnType<ItemKey>, Item[ItemValue]>;
1952
1955
  /**
1953
1956
  * Create a record from an array of items using a specific key and value, and grouping them into arrays
1954
1957
  */
@@ -1961,7 +1964,7 @@ export declare function groupBy<
1961
1964
  key: ItemKey,
1962
1965
  value: ItemValue,
1963
1966
  arrays: true,
1964
- ): Record<ReturnType<ItemKey>, Array<KeyedValue<Item, ItemValue>>>;
1967
+ ): Record<ReturnType<ItemKey>, Array<Item[ItemValue]>>;
1965
1968
  /**
1966
1969
  * Create a record from an array of items using a specific key and value
1967
1970
  */
@@ -1973,7 +1976,7 @@ export declare function groupBy<
1973
1976
  array: Item[],
1974
1977
  key: ItemKey,
1975
1978
  value: ItemValue,
1976
- ): Record<ReturnType<ItemKey>, ReturnType<ItemValue>>;
1979
+ ): Simplify<Record<ReturnType<ItemKey>, ReturnType<ItemValue>>>;
1977
1980
  /**
1978
1981
  * Create a record from an array of items using a specific key and value, and grouping them into arrays
1979
1982
  */
@@ -2123,18 +2126,14 @@ export declare function toMap<Item>(array: Item[]): Map<number, Item>;
2123
2126
  export declare function toMap<
2124
2127
  Item extends PlainObject,
2125
2128
  ItemKey extends keyof Item,
2126
- >(array: Item[], key: ItemKey): Map<KeyedValue<Item, ItemKey>, Item>;
2129
+ >(array: Item[], key: ItemKey): Map<Item[ItemKey], Item>;
2127
2130
  /**
2128
2131
  * Create a map from an array of items using a specific key, and grouping them into arrays
2129
2132
  */
2130
2133
  export declare function toMap<
2131
2134
  Item extends PlainObject,
2132
2135
  ItemKey extends keyof Item,
2133
- >(
2134
- array: Item[],
2135
- key: ItemKey,
2136
- arrays: true,
2137
- ): Map<KeyedValue<Item, ItemKey>, Item[]>;
2136
+ >(array: Item[], key: ItemKey, arrays: true): Map<Item[ItemKey], Item[]>;
2138
2137
  /**
2139
2138
  * Create a map from an array of items using a specific key
2140
2139
  */
@@ -2160,7 +2159,7 @@ export declare function toMap<
2160
2159
  array: Item[],
2161
2160
  key: ItemKey,
2162
2161
  value: ItemValue,
2163
- ): Map<KeyedValue<Item, ItemKey>, KeyedValue<Item, ItemValue>>;
2162
+ ): Map<Item[ItemKey], Item[ItemValue]>;
2164
2163
  /**
2165
2164
  * Create a map from an array of items using a specific key and value, and grouping them into arrays
2166
2165
  */
@@ -2173,7 +2172,7 @@ export declare function toMap<
2173
2172
  key: ItemKey,
2174
2173
  value: ItemValue,
2175
2174
  arrays: true,
2176
- ): Map<KeyedValue<Item, ItemKey>, Array<KeyedValue<Item, ItemValue>>>;
2175
+ ): Map<Item[ItemKey], Array<Item[ItemValue]>>;
2177
2176
  /**
2178
2177
  * Create a map from an array of items using a specific key and value
2179
2178
  */
@@ -2185,7 +2184,7 @@ export declare function toMap<
2185
2184
  array: Item[],
2186
2185
  key: ItemKey,
2187
2186
  value: ItemValue,
2188
- ): Map<KeyedValue<Item, ItemKey>, ReturnType<ItemValue>>;
2187
+ ): Map<Item[ItemKey], ReturnType<ItemValue>>;
2189
2188
  /**
2190
2189
  * Create a map from an array of items using a specific key and value, and grouping them into arrays
2191
2190
  */
@@ -2198,7 +2197,7 @@ export declare function toMap<
2198
2197
  key: ItemKey,
2199
2198
  value: ItemValue,
2200
2199
  arrays: true,
2201
- ): Map<KeyedValue<Item, ItemKey>, Array<ReturnType<ItemValue>>>;
2200
+ ): Map<Item[ItemKey], Array<ReturnType<ItemValue>>>;
2202
2201
  /**
2203
2202
  * Create a map from an array of items using a specific key and value
2204
2203
  */
@@ -2210,7 +2209,7 @@ export declare function toMap<
2210
2209
  array: Item[],
2211
2210
  key: ItemKey,
2212
2211
  value: ItemValue,
2213
- ): Map<ReturnType<ItemKey>, KeyedValue<Item, ItemValue>>;
2212
+ ): Map<ReturnType<ItemKey>, Item[ItemValue]>;
2214
2213
  /**
2215
2214
  * Create a map from an array of items using a specific key and value, and grouping them into arrays
2216
2215
  */
@@ -2223,32 +2222,32 @@ export declare function toMap<
2223
2222
  key: ItemKey,
2224
2223
  value: ItemValue,
2225
2224
  arrays: true,
2226
- ): Map<ReturnType<ItemKey>, Array<KeyedValue<Item, ItemValue>>>;
2225
+ ): Map<ReturnType<ItemKey>, Array<Item[ItemValue]>>;
2227
2226
  /**
2228
2227
  * Create a map from an array of items using a specific key and value
2229
2228
  */
2230
2229
  export declare function toMap<
2231
2230
  Item,
2232
- Key extends (item: Item, index: number, array: Item[]) => Key,
2233
- Value extends (item: Item, index: number, array: Item[]) => unknown,
2231
+ ItemKey extends (item: Item, index: number, array: Item[]) => Key,
2232
+ ItemValue extends (item: Item, index: number, array: Item[]) => unknown,
2234
2233
  >(
2235
2234
  array: Item[],
2236
- key: Key,
2237
- value: Value,
2238
- ): Map<ReturnType<Key>, ReturnType<Value>>;
2235
+ key: ItemKey,
2236
+ value: ItemValue,
2237
+ ): Map<ReturnType<ItemKey>, ReturnType<ItemValue>>;
2239
2238
  /**
2240
2239
  * Create a map from an array of items using a specific key and value, and grouping them into arrays
2241
2240
  */
2242
2241
  export declare function toMap<
2243
2242
  Item,
2244
- Key extends (item: Item, index: number, array: Item[]) => Key,
2245
- Value extends (item: Item, index: number, array: Item[]) => unknown,
2243
+ ItemKey extends (item: Item, index: number, array: Item[]) => Key,
2244
+ ItemValue extends (item: Item, index: number, array: Item[]) => unknown,
2246
2245
  >(
2247
2246
  array: Item[],
2248
- key: Key,
2249
- value: Value,
2247
+ key: ItemKey,
2248
+ value: ItemValue,
2250
2249
  arrays: true,
2251
- ): Map<ReturnType<Key>, Array<ReturnType<Value>>>;
2250
+ ): Map<ReturnType<ItemKey>, Array<ReturnType<ItemValue>>>;
2252
2251
  /**
2253
2252
  * Create a record from an array of items _(using their indices as keys)_
2254
2253
  */
@@ -2259,7 +2258,10 @@ export declare function toRecord<Item>(array: Item[]): Record<number, Item>;
2259
2258
  export declare function toRecord<
2260
2259
  Item extends PlainObject,
2261
2260
  ItemKey extends keyof Item,
2262
- >(array: Item[], key: ItemKey): Record<KeyedValue<Item, ItemKey>, Item>;
2261
+ >(
2262
+ array: Item[],
2263
+ key: ItemKey,
2264
+ ): Simplify<Record<KeyedValue<Item, ItemKey>, Item>>;
2263
2265
  /**
2264
2266
  * Create a record from an array of items using a specific key, and grouping them into arrays
2265
2267
  */
@@ -2270,7 +2272,7 @@ export declare function toRecord<
2270
2272
  array: Item[],
2271
2273
  key: ItemKey,
2272
2274
  arrays: true,
2273
- ): Record<KeyedValue<Item, ItemKey>, Item[]>;
2275
+ ): Simplify<Record<KeyedValue<Item, ItemKey>, Item[]>>;
2274
2276
  /**
2275
2277
  * Create a record from an array of items using a specific key
2276
2278
  */
@@ -2300,7 +2302,7 @@ export declare function toRecord<
2300
2302
  array: Item[],
2301
2303
  key: ItemKey,
2302
2304
  value: ItemValue,
2303
- ): Record<KeyedValue<Item, ItemKey>, KeyedValue<Item, ItemValue>>;
2305
+ ): Simplify<Record<KeyedValue<Item, ItemKey>, Item[ItemValue]>>;
2304
2306
  /**
2305
2307
  * Create a record from an array of items using a specific key and value, and grouping them into arrays
2306
2308
  */
@@ -2313,7 +2315,7 @@ export declare function toRecord<
2313
2315
  key: ItemKey,
2314
2316
  value: ItemValue,
2315
2317
  arrays: true,
2316
- ): Record<KeyedValue<Item, ItemKey>, Array<KeyedValue<Item, ItemValue>>>;
2318
+ ): Simplify<Record<KeyedValue<Item, ItemKey>, Array<Item[ItemValue]>>>;
2317
2319
  /**
2318
2320
  * Create a record from an array of items using a specific key and value
2319
2321
  */
@@ -2325,7 +2327,7 @@ export declare function toRecord<
2325
2327
  array: Item[],
2326
2328
  key: ItemKey,
2327
2329
  value: ItemValue,
2328
- ): Record<KeyedValue<Item, ItemKey>, ReturnType<ItemValue>>;
2330
+ ): Simplify<Record<KeyedValue<Item, ItemKey>, ReturnType<ItemValue>>>;
2329
2331
  /**
2330
2332
  * Create a record from an array of items using a specific key and value, and grouping them into arrays
2331
2333
  */
@@ -2338,7 +2340,7 @@ export declare function toRecord<
2338
2340
  key: ItemKey,
2339
2341
  value: ItemValue,
2340
2342
  arrays: true,
2341
- ): Record<KeyedValue<Item, ItemKey>, Array<ReturnType<ItemValue>>>;
2343
+ ): Simplify<Record<KeyedValue<Item, ItemKey>, Array<ReturnType<ItemValue>>>>;
2342
2344
  /**
2343
2345
  * Create a record from an array of items using a specific key and value
2344
2346
  */
@@ -2350,7 +2352,7 @@ export declare function toRecord<
2350
2352
  array: Item[],
2351
2353
  key: ItemKey,
2352
2354
  value: ItemValue,
2353
- ): Record<ReturnType<ItemKey>, KeyedValue<Item, ItemValue>>;
2355
+ ): Record<ReturnType<ItemKey>, Item[ItemValue]>;
2354
2356
  /**
2355
2357
  * Create a record from an array of items using a specific key and value, and grouping them into arrays
2356
2358
  */
@@ -2363,7 +2365,7 @@ export declare function toRecord<
2363
2365
  key: ItemKey,
2364
2366
  value: ItemValue,
2365
2367
  arrays: true,
2366
- ): Record<ReturnType<ItemKey>, Array<KeyedValue<Item, ItemValue>>>;
2368
+ ): Record<ReturnType<ItemKey>, Array<Item[ItemValue]>>;
2367
2369
  /**
2368
2370
  * Create a record from an array of items using a specific key and value
2369
2371
  */