export type BrowserNativeObject = Date | FileList | File; export type Primitive = null | undefined | string | number | boolean | symbol | bigint; export type IsAny = 0 extends 1 & T ? true : false; export type IsNever = [T] extends [never] ? true : false; export type PathString = string; export type Traversable = object; export type IsTuple> = number extends T["length"] ? false : true; export type ArrayKey = number; export type Key = string; export type AsKey = Extract; export type ToKey = T extends ArrayKey ? `${T}` : AsKey; export type PathTuple = Key[]; export type AsPathTuple = Extract; export type UnionToIntersection = (U extends any ? (_: U) => any : never) extends (_: infer I) => any ? I : never; type AppendNonBlankKey = K extends "" ? PT : [...PT, K]; type SplitPathStringImpl = PS extends `${infer K}.${infer R}` ? SplitPathStringImpl> : AppendNonBlankKey; export type SplitPathString = SplitPathStringImpl; type JoinPathTupleImpl = PT extends [infer K, ...infer R] ? JoinPathTupleImpl, `${PS}.${AsKey}`> : PS; export type JoinPathTuple = PT extends [infer K, ...infer R] ? JoinPathTupleImpl, AsKey> : never; type MapKeys = { [K in keyof T as ToKey]: T[K]; }; type TryAccess = K extends keyof T ? T[K] : T extends null ? null : undefined; type TryAccessArray, K extends Key> = K extends `${ArrayKey}` ? T[number] : TryAccess; export type EvaluateKey = T extends ReadonlyArray ? IsTuple extends true ? TryAccess : TryAccessArray : TryAccess, K>; export type EvaluatePath = PT extends [infer K, ...infer R] ? EvaluatePath>, AsPathTuple> : T; export type TupleKeys> = Exclude; type NumericObjectKeys = ToKey>; export type NumericKeys = UnionToIntersection ? (IsTuple extends true ? [TupleKeys] : [ToKey]) : [NumericObjectKeys]>[never]; export type ObjectKeys = Exclude, `${string}.${string}` | "">; export type CheckKeyConstraint = K extends any ? (EvaluateKey extends U ? K : never) : never; export type ContainsIndexable = IsNever>> extends true ? false : true; type KeysImpl = [T] extends [Traversable] ? (ContainsIndexable extends true ? NumericKeys : ObjectKeys) : never; export type Keys = IsAny extends true ? Key : IsNever extends true ? Key : IsNever> extends true ? never : CheckKeyConstraint>, U>; export type HasKey = IsNever>>; type ValidPathPrefixImpl = PT extends [infer K, ...infer R] ? HasKey> extends true ? ValidPathPrefixImpl>, AsPathTuple, AsPathTuple<[...VPT, K]>> : VPT : VPT; export type ValidPathPrefix = ValidPathPrefixImpl; export type HasPath = ValidPathPrefix extends PT ? true : false; export {};