bowen
2023-10-10 30b3ee5c89c31cb5794faab40e800c36507d258a
packages/types/src/utils.ts
@@ -1,17 +1,17 @@
/**
 * 任意类型的函数
 */
type AnyFunction = AnyNormalFunction | AnyPromiseFunction;
/**
 * 任意类型的异步函数
 */
type AnyPromiseFunction = (...arg: any) => PromiseLike<any>;
type AnyPromiseFunction = (...arg: any[]) => PromiseLike<any>;
/**
 * 任意类型的普通函数
 */
type AnyNormalFunction = (...arg: any) => any;
type AnyNormalFunction = (...arg: any[]) => any;
/**
 * 任意类型的函数
 */
type AnyFunction = AnyNormalFunction | AnyPromiseFunction;
/**
 *  T | null 包装
@@ -26,21 +26,33 @@
/**
 * 字符串类型对象
 */
type Recordable<T> = Record<string, T>;
type Recordable<T = any> = Record<string, T>;
/**
 * 字符串类型对象(只读)
 */
type ReadonlyRecordable<T = any> = {
interface ReadonlyRecordable<T = any> {
  readonly [key: string]: T;
};
}
/**
 * setTimeout 返回值类型
 */
type TimeoutHandle = ReturnType<typeof setTimeout>;
/**
 * setInterval 返回值类型
 */
type IntervalHandle = ReturnType<typeof setInterval>;
export {
  type AnyFunction,
  type AnyPromiseFunction,
  type AnyNormalFunction,
  type Nullable,
  type AnyPromiseFunction,
  type IntervalHandle,
  type NonNullable,
  type Recordable,
  type Nullable,
  type ReadonlyRecordable,
  type Recordable,
  type TimeoutHandle,
};