18 lines
657 B
TypeScript
18 lines
657 B
TypeScript
export type Nullable<T> = T | null;
|
|
export type Recordable<T = any> = Record<string, T>;
|
|
export interface ReadonlyRecordable<T = any> {
|
|
readonly [key: string]: T
|
|
}
|
|
export type EmitType = (event: string, ...args: any[]) => void;
|
|
export interface Fn<T = any, R = T> {
|
|
(...arg: T[]): R
|
|
}
|
|
export type Promisable<T> = T | Promise<T>;
|
|
export type Nullable1<T> = T | null | undefined;
|
|
export type Functional<T> = T | ((...args: any[]) => T);
|
|
export type DeepPath<T extends object, Prefix extends string = ''> = {
|
|
[K in keyof T & string]: T[K] extends object
|
|
? `${Prefix}${K}` | DeepPath<T[K], `${Prefix}${K}.`>
|
|
: `${Prefix}${K}`
|
|
}[keyof T & string];
|