fix(lib/utils): use Reflect.ownKeys and PropertyKey for correctness
This commit is contained in:
parent
c096b80225
commit
cb334d0b9c
2 changed files with 2 additions and 2 deletions
|
|
@ -35,7 +35,7 @@ export function cloneDeep<T>(source: T, cache = new WeakMap()): T {
|
||||||
const sourceObj = source as AnyObject
|
const sourceObj = source as AnyObject
|
||||||
const cloneObj = clone as AnyObject
|
const cloneObj = clone as AnyObject
|
||||||
|
|
||||||
const keys = Object.keys(sourceObj)
|
const keys = Reflect.ownKeys(sourceObj)
|
||||||
for (let i = 0; i < keys.length; i++) {
|
for (let i = 0; i < keys.length; i++) {
|
||||||
const key = keys[i]
|
const key = keys[i]
|
||||||
cloneObj[key] = cloneDeep(sourceObj[key], cache)
|
cloneObj[key] = cloneDeep(sourceObj[key], cache)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
export type Nullish = null | undefined
|
export type Nullish = null | undefined
|
||||||
export type If<T, Then, Else> = T extends true ? Then : Else
|
export type If<T, Then, Else> = T extends true ? Then : Else
|
||||||
export type Not<T extends boolean> = T extends true ? false : true
|
export type Not<T extends boolean> = T extends true ? false : true
|
||||||
export type AnyObject = Record<any, any>
|
export type AnyObject = Record<PropertyKey, any>
|
||||||
export type AnyFunction = (...args: any[]) => any
|
export type AnyFunction = (...args: any[]) => any
|
||||||
export type LogicalOr<T1, T2> = T1 extends true
|
export type LogicalOr<T1, T2> = T1 extends true
|
||||||
? true
|
? true
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue