es-toolkit 1.52.0-dev.2144 → 1.52.0-dev.2145
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Creates a union of the keys of `T` as they are returned by `Object.keys`:
|
|
3
|
-
* numeric keys are converted to strings and symbol keys are excluded
|
|
3
|
+
* numeric keys are converted to strings and symbol keys are excluded, while
|
|
4
|
+
* string keys, including enum members, are kept as they are. The key-side
|
|
4
5
|
* counterpart to `ValueOf`.
|
|
5
6
|
*
|
|
6
7
|
* @template T - The object type to read keys from.
|
|
@@ -13,4 +14,4 @@
|
|
|
13
14
|
* const keys = Object.keys(obj) as Array<ObjectKeys<typeof obj>>;
|
|
14
15
|
* // => Array<'a' | 'b'>
|
|
15
16
|
*/
|
|
16
|
-
export type ObjectKeys<T> = `${
|
|
17
|
+
export type ObjectKeys<T> = [T] extends [unknown] ? Extract<keyof T, string> | `${Extract<keyof T, number>}` : never;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Creates a union of the keys of `T` as they are returned by `Object.keys`:
|
|
3
|
-
* numeric keys are converted to strings and symbol keys are excluded
|
|
3
|
+
* numeric keys are converted to strings and symbol keys are excluded, while
|
|
4
|
+
* string keys, including enum members, are kept as they are. The key-side
|
|
4
5
|
* counterpart to `ValueOf`.
|
|
5
6
|
*
|
|
6
7
|
* @template T - The object type to read keys from.
|
|
@@ -13,4 +14,4 @@
|
|
|
13
14
|
* const keys = Object.keys(obj) as Array<ObjectKeys<typeof obj>>;
|
|
14
15
|
* // => Array<'a' | 'b'>
|
|
15
16
|
*/
|
|
16
|
-
export type ObjectKeys<T> = `${
|
|
17
|
+
export type ObjectKeys<T> = [T] extends [unknown] ? Extract<keyof T, string> | `${Extract<keyof T, number>}` : never;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "es-toolkit",
|
|
3
|
-
"version": "1.52.0-dev.
|
|
3
|
+
"version": "1.52.0-dev.2145+cf6fd187",
|
|
4
4
|
"description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.",
|
|
5
5
|
"homepage": "https://es-toolkit.dev",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|