declare const uniqueIdentifier: unique symbol; /** * Makes the type unique without polluting the object with extra properties. \ * You only need to use this if you have multiple collections with the **exact** same shape. * * @template T - The type for the collection * @template U - A **unique** identifier (e.g. name of the collection) * @example * type User = UniqueCollection<{ name: string }, 'users'> */ export type UniqueCollection = T & { readonly [uniqueIdentifier]: U; }; type RemoveModifier = T extends `${infer U}:${string}` ? U : T; /** Removes modifiers and turns `fields` array to union if it's not `undefined` i.e. not specified */ export type FieldsArrayToUnion = T extends Array ? RemoveModifier : T; export type UnwrapArray = T extends Array ? U : T; /** * Get a single, non-nullable type from the schema declaration * * @example * interface Foo { * bar?: Bar[] * } * type Result = GetSingleType // Bar */ export type GetSingleType = NonNullable>; export type MergeObjects = Omit & U; export type ValueOf> = T[keyof T]; export type UnionToIntersection = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never; export type IsArray = T extends Array ? true : false; export type Equals = (() => T extends X ? 1 : 2) extends () => (T extends Y ? 1 : 2) ? true : false; export type And = T | U extends true ? true : false; export type Or = true extends T | U ? true : false; export type Join = T extends [string] ? T[0] : T extends [infer First extends string, ...infer Rest extends string[]] ? `${First}${Separator}${Join}` : never; export {};