/* eslint-disable @typescript-eslint/no-explicit-any */ export type Expect = T export type Equal = (() => T extends X ? 1 : 2) extends () => T extends Y ? 1 : 2 ? true : false export type NotEqual = true extends Equal ? false : true export type UnionToIntersection = (U extends any ? (k: U) => void : never) extends ( k: infer I ) => void ? I : never export type RemoveBlankRecord = T extends Record ? K extends string ? T : never : never export type IfAnyThenEmptyObject = 0 extends 1 & T ? {} : T export type JSONPrimitive = string | boolean | number | null | undefined export type JSONArray = (JSONPrimitive | JSONObject | JSONArray)[] export type JSONObject = { [key: string]: JSONPrimitive | JSONArray | JSONObject | object } export type JSONValue = JSONObject | JSONArray | JSONPrimitive // Non-JSON values such as `Date` implement `.toJSON()`, so they can be transformed to a value assignable to `JSONObject`: export type JSONParsed = T extends { toJSON(): infer J } ? (() => J) extends () => JSONObject ? J : JSONParsed : T extends JSONPrimitive ? T : T extends Array ? Array> : T extends object ? { [K in keyof T]: JSONParsed } : never export type InterfaceToType = T extends Function ? T : { [K in keyof T]: InterfaceToType } export type RequiredKeysOf = Exclude< { [Key in keyof BaseType]: BaseType extends Record ? Key : never }[keyof BaseType], undefined > export type HasRequiredKeys = RequiredKeysOf extends never ? false : true export type IsAny = boolean extends (T extends never ? true : false) ? true : false