2021-08-26 17:00:18 +08:00
|
|
|
import type { CSSProperties, Plugin } from 'vue'
|
2020-12-23 14:07:15 +08:00
|
|
|
|
2020-08-04 10:49:49 +08:00
|
|
|
type OptionalKeys<T extends Record<string, unknown>> = {
|
2021-09-04 19:29:28 +08:00
|
|
|
[K in keyof T]: T extends Record<K, T[K]> ? never : K
|
2020-08-02 18:27:46 +08:00
|
|
|
}[keyof T]
|
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
type RequiredKeys<T extends Record<string, unknown>> = Exclude<
|
|
|
|
keyof T,
|
|
|
|
OptionalKeys<T>
|
|
|
|
>
|
2020-08-02 18:27:46 +08:00
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
type MonoArgEmitter<T, Keys extends keyof T> = <K extends Keys>(
|
|
|
|
evt: K,
|
|
|
|
arg?: T[K]
|
|
|
|
) => void
|
2020-08-02 18:27:46 +08:00
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
type BiArgEmitter<T, Keys extends keyof T> = <K extends Keys>(
|
|
|
|
evt: K,
|
|
|
|
arg: T[K]
|
|
|
|
) => void
|
2020-08-02 18:27:46 +08:00
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
export type EventEmitter<T extends Record<string, unknown>> = MonoArgEmitter<
|
|
|
|
T,
|
|
|
|
OptionalKeys<T>
|
|
|
|
> &
|
|
|
|
BiArgEmitter<T, RequiredKeys<T>>
|
2020-08-24 15:38:30 +08:00
|
|
|
|
|
|
|
export type AnyFunction<T> = (...args: any[]) => T
|
2020-09-03 21:19:12 +08:00
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
export type PartialReturnType<T extends (...args: unknown[]) => unknown> =
|
|
|
|
Partial<ReturnType<T>>
|
2020-12-23 14:07:15 +08:00
|
|
|
|
2021-07-25 15:26:00 +08:00
|
|
|
export type SFCWithInstall<T> = T & Plugin
|
2021-07-13 17:30:41 +08:00
|
|
|
|
2021-07-28 10:16:41 +08:00
|
|
|
export type RefElement = HTMLElement | null
|
2021-08-24 13:36:48 +08:00
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
export type Nullable<T> = T | null
|
2021-08-24 13:36:48 +08:00
|
|
|
|
|
|
|
export type CustomizedHTMLElement<T> = HTMLElement & T
|
|
|
|
|
|
|
|
export type Indexable<T> = {
|
|
|
|
[key: string]: T
|
|
|
|
}
|
|
|
|
|
|
|
|
export type Hash<T> = Indexable<T>
|
|
|
|
|
|
|
|
export type TimeoutHandle = ReturnType<typeof global.setTimeout>
|
|
|
|
|
|
|
|
export type ComponentSize = 'large' | 'medium' | 'small' | 'mini'
|
2021-08-26 17:00:18 +08:00
|
|
|
|
|
|
|
export type StyleValue = string | CSSProperties | Array<StyleValue>
|