/** * Deep setting utils * * Derived from @url https://github.com/react-hook-form/react-hook-form/tree/011fad503cc8d4543892f8e847b9bd58c1d9400f/src/types/path * */ /** * Checks whether the type is any * See {@link https://stackoverflow.com/a/49928360/3406963} * @typeParam T - type which may be any * ``` * IsAny = true * IsAny = false * ``` */ export type IsAny = 0 extends 1 & T ? true : false; /** * Checks whether the type is never * @typeParam T - type which may be never * ``` * IsAny = true * IsAny = false * ``` */ export type Primitive = null | undefined | string | number | boolean | symbol | bigint; export type BrowserNativeObject = Date | FileList | File; /** * Checks whether T1 can be exactly (mutually) assigned to T2 * @typeParam T1 - type to check * @typeParam T2 - type to check against * ``` * IsEqual = true * IsEqual<'foo', 'foo'> = true * IsEqual = false * IsEqual = false * IsEqual = false * IsEqual<'foo', string> = false * IsEqual<'foo' | 'bar', 'foo'> = boolean // 'foo' is assignable, but 'bar' is not (true | false) -> boolean * ``` */ export type IsEqual = T1 extends T2 ? (() => G extends T1 ? 1 : 2) extends () => G extends T2 ? 1 : 2 ? true : false : false; /** * Type to query whether an array type T is a tuple type. * @typeParam T - type which may be an array or tuple * @example * ``` * IsTuple<[number]> = true * IsTuple = false * ``` */ export type IsTuple> = number extends T['length'] ? false : true; /** * Type which can be used to index an array or tuple type. */ export type ArrayKey = number; /** * Type which given a tuple type returns its own keys, i.e. only its indices. * @typeParam T - tuple type * @example * ``` * TupleKeys<[number, string]> = '0' | '1' * ``` */ export type TupleKeys> = Exclude; //# sourceMappingURL=common.d.ts.map