types(Picker): use tsx (#8137)
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import { deepAssign } from './deep-assign';
|
||||
|
||||
export function deepClone(obj: Record<string, any>): Record<string, any> {
|
||||
export function deepClone<T extends Record<string, any>>(obj: T): T {
|
||||
if (Array.isArray(obj)) {
|
||||
return obj.map((item) => deepClone(item));
|
||||
return (obj.map((item) => deepClone(item)) as unknown) as T;
|
||||
}
|
||||
|
||||
if (typeof obj === 'object') {
|
||||
return deepAssign({}, obj);
|
||||
return deepAssign({}, obj) as T;
|
||||
}
|
||||
|
||||
return obj;
|
||||
|
||||
Reference in New Issue
Block a user