wujingjing
2024-10-31 28b72064712a3d97b44511206a2dca07f2d37a23
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { ref} from 'vue';
 
export const isUndefined = (val: any): val is undefined => val === undefined;
export const isBoolean = (val: any): val is boolean => typeof val === 'boolean';
export const isNumber = (val: any): val is number => typeof val === 'number';
 
 
 
export const isFilledArray = (val: any) => Array.isArray(val) && val.length > 0;
 
/**
 *
 * @param _comp 组件构造函数
 * @returns 组件 ref
 * @example const formRef = useCompRef(ElForm);
 */
export const useCompRef = <T extends abstract new (...args: any) => any>(_comp: T) => ref<InstanceType<T>>();
 
 
/**
 * 深层次 Partial
 */
export type DeepPartial<T> = T extends object ? {
    [P in keyof T]?: DeepPartial<T[P]>;
} : T;