ll-package
Version:
38 lines (27 loc) • 1.09 kB
TypeScript
declare interface Fn<T = any, R = T> {
(...arg: T[]): R
}
declare interface PromiseFn<T = any, R = T> {
(...arg: T[]): Promise<R>
}
declare type RefType<T> = T | null
declare type LabelValueOptions = {
label: string
value: any
[key: string]: string | number | boolean
}[]
declare type EmitType = (event: string, ...args: any[]) => void
declare type TargetContext = '_self' | '_blank'
declare interface ComponentElRef<T extends HTMLElement = HTMLDivElement> {
$el: T
}
declare type ComponentRef<T extends HTMLElement = HTMLDivElement> =
ComponentElRef<T> | null
declare type ElRef<T extends HTMLElement = HTMLDivElement> = Nullable<T>
// 声明一个Nullable类型,T可以是任意类型,也可以为null
declare type Nullable<T> = T | null
// 声明一个NonNullable类型,T必须是任意类型,不能为null
declare type NonNullable<T> = T extends null | undefined ? never : T
// 声明一个Recordable类型,T默认为任意类型
declare type Recordable<T = any> = Record<string, T>
declare type TimeoutHandle = ReturnType<typeof global.setTimeout>