{"version":3,"file":"typescript.mjs","names":[],"sources":["../../../../packages/utils/typescript.ts"],"sourcesContent":["import type * as CSS from 'csstype'\n\nexport const mutable = <T extends readonly any[] | Record<string, unknown>>(\n  val: T\n) => val as Mutable<typeof val>\nexport type Mutable<T> = { -readonly [P in keyof T]: T[P] }\n\nexport type HTMLElementCustomized<T> = HTMLElement & T\n\n/**\n * @deprecated stop to use null\n * @see {@link https://github.com/sindresorhus/meta/discussions/7}\n */\nexport type Nullable<T> = T | null\n\nexport type Arrayable<T> = T | T[]\nexport type Awaitable<T> = Promise<T> | T\n\ntype Primitive = null | undefined | string | number | boolean | symbol | bigint\ntype BrowserNativeObject = Date | FileList | File | Blob | RegExp\n\n/**\n * Check whether it is tuple\n *\n * 检查是否为元组\n *\n * @example\n * IsTuple<[1, 2, 3]> => true\n * IsTuple<Array[number]> => false\n */\ntype IsTuple<T extends ReadonlyArray<any>> = number extends T['length']\n  ? false\n  : true\n\n/**\n * Array method key\n *\n * 数组方法键\n */\ntype ArrayMethodKey = keyof any[]\n\n/**\n * Tuple index key\n *\n * 元组下标键\n *\n * @example\n * TupleKey<[1, 2, 3]> => '0' | '1' | '2'\n */\ntype TupleKey<T extends ReadonlyArray<any>> = Exclude<keyof T, ArrayMethodKey>\n\n/**\n * Array index key\n *\n * 数组下标键\n */\ntype ArrayKey = number\n\n/**\n * Helper type for recursively constructing paths through a type\n *\n * 用于通过一个类型递归构建路径的辅助类型\n */\ntype PathImpl<K extends string | number, V> = V extends\n  | Primitive\n  | BrowserNativeObject\n  ? `${K}`\n  : `${K}` | `${K}.${Path<V>}`\n\n/**\n * Type which collects all paths through a type\n *\n * 通过一个类型收集所有路径的类型\n *\n * @see {@link FieldPath}\n */\ntype Path<T> =\n  T extends ReadonlyArray<infer V>\n    ? IsTuple<T> extends true\n      ? {\n          [K in TupleKey<T>]-?: PathImpl<Exclude<K, symbol>, T[K]>\n        }[TupleKey<T>] // tuple\n      : PathImpl<ArrayKey, V> // array\n    : {\n        [K in keyof T]-?: PathImpl<Exclude<K, symbol>, T[K]>\n      }[keyof T] // object\n\n/**\n * Type which collects all paths through a type\n *\n * 通过一个类型收集所有路径的类型\n *\n * @example\n * FieldPath<{ 1: number; a: number; b: string; c: { d: number; e: string }; f: [{ value: string }]; g: { value: string }[]; h: Date; i: FileList; j: File; k: Blob; l: RegExp }> => '1' | 'a' | 'b' | 'c' | 'f' | 'g' | 'c.d' | 'c.e' | 'f.0' | 'f.0.value' | 'g.number' | 'g.number.value' | 'h' | 'i' | 'j' | 'k' | 'l'\n */\nexport type FieldPath<T> = T extends object ? Path<T> : never\n\n/**\n * csstype 是 vue的依赖，因此，直接从vue中导入CSSProperties会导致ts类型解析错误，参考 https://github.com/pnpm/pnpm/issues/7453，因此，我们直接安装csstype，并从csstype中导入CSSProperties\n *\n * csstype is a dependency of vue, so importing CSSProperties directly from vue will cause ts type parsing errors, see https://github.com/pnpm/pnpm/issues/7453. Therefore, we directly install csstype and import CSSProperties from csstype.\n */\nexport interface CSSProperties\n  extends\n    CSS.Properties<string | number>,\n    CSS.PropertiesHyphen<string | number> {\n  /**\n   * The index signature was removed to enable closed typing for style\n   * using CSSType. You're able to use type assertion or module augmentation\n   * to add properties or an index signature of your own.\n   *\n   * For examples and more information, visit:\n   * https://github.com/frenic/csstype#what-should-i-do-when-i-get-type-errors\n   */\n  [v: `--${string}`]: string | number | undefined\n}\n\nexport type ObjectFit = CSSProperties['objectFit']\n\nexport type ZIndexType = CSSProperties['zIndex']\n\nexport type AlignItems = CSSProperties['alignItems']\n"],"mappings":";AAEA,MAAa,WACX,QACG"}