Initial project
This commit is contained in:
43
src/types.ts
Normal file
43
src/types.ts
Normal file
@ -0,0 +1,43 @@
|
||||
import type { Plugin } from "vue";
|
||||
|
||||
/**
|
||||
* 安装方法
|
||||
*/
|
||||
export type InstallRecord<T> = T & Plugin;
|
||||
|
||||
/**
|
||||
* 默认插槽参数
|
||||
*/
|
||||
export type DefaultSlotProp = (props: {}) => unknown
|
||||
|
||||
/**
|
||||
* 默认插槽类型
|
||||
*/
|
||||
export interface DefaultSlots {
|
||||
default: DefaultSlotProp;
|
||||
icon?: DefaultSlotProp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 合并类型为交叉类型
|
||||
*/
|
||||
export type Merge<T, R> = {
|
||||
[K in keyof T]: T[K]
|
||||
} & {
|
||||
[K in keyof R]: R[K]
|
||||
}
|
||||
|
||||
/**
|
||||
* 合并交叉类型
|
||||
*/
|
||||
type MergeIntersection<T> = Pick<T, keyof T>
|
||||
|
||||
/**
|
||||
* 提取必传属性
|
||||
*/
|
||||
export type PickRequiredUnion<P, U extends keyof P> = MergeIntersection<Merge<Required<Pick<P, U>>, Omit<P, U>>>
|
||||
|
||||
/**
|
||||
* 除了提取的属性,其他都是必传属性
|
||||
*/
|
||||
export type PickNotRequiredUnion<P, U extends keyof P> = MergeIntersection<Merge<Pick<P, U>, Required<Omit<P, U>>>>
|
||||
Reference in New Issue
Block a user