@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 +3 -9
- package/dist/types.js +1 -2
- package/package.json +1 -1
- package/src/types.ts +3 -10
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
|
-
*
|
|
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) =>
|
|
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:
|
|
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
|
|
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
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
|
-
*
|
|
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) =>
|
|
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:
|
|
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
|