@naturalcycles/js-lib 15.49.0 → 15.49.1

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/dist/types.d.ts CHANGED
@@ -288,23 +288,17 @@ export declare const _stringMapValues: <T>(map: StringMap<T>) => T[];
288
288
  */
289
289
  export declare const _stringMapEntries: <T>(map: StringMap<T>) => [k: string, v: T][];
290
290
  /**
291
- * Resolves to a string literal union of the keys of T, meaning they are
292
- * always keys of T and always strings (never numbers or symbols).
293
- */
294
- export type ObjectKey<T> = `${Extract<keyof T, string | number>}`;
295
- /**
296
- * Alias of `Object.keys`, but returns keys with a string type that's as
297
- * narrow as possible.
291
+ * Alias of `Object.keys`, but returns keys typed as `keyof T`, not as just `string`.
298
292
  * This is how TypeScript should work, actually.
299
293
  */
300
- export declare const _objectKeys: <T extends AnyObject>(obj: T) => ObjectKey<T>[];
294
+ export declare const _objectKeys: <T extends AnyObject>(obj: T) => (keyof T)[];
301
295
  /**
302
296
  * Alias of `Object.entries`, but returns better-typed output.
303
297
  *
304
298
  * So e.g you can use _objectEntries(obj).map([k, v] => {})
305
299
  * and `k` will be `keyof obj` instead of generic `string`.
306
300
  */
307
- export declare const _objectEntries: <T extends AnyObject>(obj: T) => [k: ObjectKey<T>, v: T[ObjectKey<T>]][];
301
+ export declare const _objectEntries: <T extends AnyObject>(obj: T) => [k: keyof T, v: T[keyof T]][];
308
302
  export type NullishValue = null | undefined;
309
303
  export type FalsyValue = false | '' | 0 | null | undefined;
310
304
  /**
package/dist/types.js CHANGED
@@ -31,8 +31,7 @@ export const _stringMapValues = Object.values;
31
31
  */
32
32
  export const _stringMapEntries = Object.entries;
33
33
  /**
34
- * Alias of `Object.keys`, but returns keys with a string type that's as
35
- * narrow as possible.
34
+ * Alias of `Object.keys`, but returns keys typed as `keyof T`, not as just `string`.
36
35
  * This is how TypeScript should work, actually.
37
36
  */
38
37
  export const _objectKeys = Object.keys;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/js-lib",
3
3
  "type": "module",
4
- "version": "15.49.0",
4
+ "version": "15.49.1",
5
5
  "dependencies": {
6
6
  "tslib": "^2",
7
7
  "undici": "^7",
package/src/types.ts CHANGED
@@ -361,17 +361,10 @@ export const _stringMapValues = Object.values as <T>(map: StringMap<T>) => T[]
361
361
  export const _stringMapEntries = Object.entries as <T>(map: StringMap<T>) => [k: string, v: T][]
362
362
 
363
363
  /**
364
- * Resolves to a string literal union of the keys of T, meaning they are
365
- * always keys of T and always strings (never numbers or symbols).
366
- */
367
- export type ObjectKey<T> = `${Extract<keyof T, string | number>}`
368
-
369
- /**
370
- * Alias of `Object.keys`, but returns keys with a string type that's as
371
- * narrow as possible.
364
+ * Alias of `Object.keys`, but returns keys typed as `keyof T`, not as just `string`.
372
365
  * This is how TypeScript should work, actually.
373
366
  */
374
- export const _objectKeys = Object.keys as <T extends AnyObject>(obj: T) => ObjectKey<T>[]
367
+ export const _objectKeys = Object.keys as <T extends AnyObject>(obj: T) => (keyof T)[]
375
368
 
376
369
  /**
377
370
  * Alias of `Object.entries`, but returns better-typed output.
@@ -381,7 +374,7 @@ export const _objectKeys = Object.keys as <T extends AnyObject>(obj: T) => Objec
381
374
  */
382
375
  export const _objectEntries = Object.entries as <T extends AnyObject>(
383
376
  obj: T,
384
- ) => [k: ObjectKey<T>, v: T[ObjectKey<T>]][]
377
+ ) => [k: keyof T, v: T[keyof T]][]
385
378
 
386
379
  export type NullishValue = null | undefined
387
380
  export type FalsyValue = false | '' | 0 | null | undefined