/** * Type guard for checking if a value is a key of the given enum. */ declare function isEnumValue>(key: unknown, enumObject: T): key is T[keyof T]; /** * Type guard which checks if given value is inside an array. */ declare const isInArray: (value: any, array: T) => value is T[number]; /** * Type guard for checking if an object value is of a specific type by checking if a given property exists. */ declare function isOfType(value: any, property: keyof T): value is T; /** * Forcibly type an array to have at least one element. */ type ArrayWithOneOrMore = { 0: T; } & T[]; /** * Return a new record only with the keys whose values are assignable to the given type. If no keys are assignable to the given type, the resulting record must be empty. */ type ExtractRecord = { [K in keyof T as T[K] extends U ? K : never]: T[K]; }; /** * Extracts the keys of a record whose values are assignable to the given type. */ type ExtractRecordKeys, U> = keyof ExtractRecord; type MakeOptional = K extends keyof T ? Omit & Partial> : T; /** * Makes a type nullable or be undefined. */ type Maybe = T | null | undefined; /** * A type for an instantiable class. */ type Newable = new (...args: any[]) => T; /** * Allow a single value or an array of values. */ type OneOrMore = T | T[]; type PromiseOr = T | Promise; /** * Allows */ type ReadonlyOr = T | Readonly; /** * Recursively makes all properties of an object optional. */ type RecursivePartial = { [P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial[] : T[P] extends object | undefined ? RecursivePartial : T[P]; }; /** * Recursively makes all properties of an object required. */ type RecursiveRequired = { [P in keyof T]-?: T[P] extends (infer U)[] ? RecursiveRequired[] : T[P] extends object | undefined ? RecursiveRequired : T[P]; }; type Replace = Pick> & { [P in K]: TReplace; }; /** * Makes all properties of an object optional except the ones specified. */ type RequireOnly = Required> & Partial>; /** * Resolves the type of given promise. */ type ResolvePromise> = T extends Promise ? U : never; /** * Inverts a map type so that the values become the keys and the keys become the values. */ type ReverseMap> = { [P in T[keyof T]]: { [K in keyof T]: T[K] extends P ? K : never; }[keyof T]; }; /** * Get the values of a type */ type ValueOf> = T[keyof T]; type MakeRequired = Omit & Required>; /** * Returns true if every element in the array satisfies the provided predicate. */ declare const asyncEvery: (arr: A[], predicate: (value: A, index: number, array: A[]) => PromiseOr) => Promise; /** * Returns true if some element in the array satisfies the provided predicate. */ declare const asyncSome: (arr: A[], predicate: (value: A, index: number, array: A[]) => PromiseOr) => Promise; /** * Returns true if given value is undefined. */ declare const isUndefined: (value: unknown) => value is undefined; /** * Compares two objects and returns true if they are equal */ declare const objectIsEqual: (a: unknown, b: unknown) => boolean; declare const partitionArray: (array: I[] | null | undefined, predicate: (item: I) => boolean) => I[][]; /** * Removes keys and values from an object if predicate(value) returns true */ declare const removePropertiesWith: >(object: T, predicate: (value: unknown) => boolean | Promise) => Omit; /** * Convert input to an array, if it's not already an array. */ declare const toArray: (itemOrItems: OneOrMore, separator?: string) => T[]; export { type ArrayWithOneOrMore, type ExtractRecord, type ExtractRecordKeys, type MakeOptional, type MakeRequired, type Maybe, type Newable, type OneOrMore, type PromiseOr, type ReadonlyOr, type RecursivePartial, type RecursiveRequired, type Replace, type RequireOnly, type ResolvePromise, type ReverseMap, type ValueOf, asyncEvery, asyncSome, isEnumValue, isInArray, isOfType, isUndefined, objectIsEqual, partitionArray, removePropertiesWith, toArray };