export type Class = new (...args: any[]) => T; export interface AbstractClass { prototype: T; name: string; } /** * Type-guard to assert if the given object is an (abstract) class. * * @internal */ export declare function isClassLike(target: unknown): target is Class | AbstractClass; /** * Returns all parent classes of a given class. * * @internal */ export declare function getParentClasses(target: Class): Class[]; /** * Recursively flattens an arbitrarily nested array into a flat array. * * @internal */ export declare function flattenDeep(values: readonly unknown[]): T[]; /** * Ensures a given value is not null or undefined. * * @internal */ export declare function assertPresent(value: T | null | undefined): T; /** * Creates slices of an array. * * @internal */ export declare function windowedSlice(array: T[], step?: 2): [T, T][]; export declare function windowedSlice(array: T[], step: number): T[][]; /** * Retries as long as it encounters any error that is instance of `errorClass`. * Awaits the result of the `onError` callback before retrying. * * @internal */ export declare function retryOn(errorClass: Class, block: () => Promise, onError: (error: TError) => Promise): Promise; /** * Assert that there is a single element in an array. Throws the error from error provider if not. * * @internal */ export declare function assertSingle(array: T[], errorProvider: () => unknown): T; /** * Type-guard for `never` types, can be used to create exhaustive branches. * * @internal */ export declare function assertNever(_: never): never; /** * Executes a callback, wrapping its result in a Promise. * Static version of `Promise.try()` (currently stage 3). * * @internal * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/try */ export declare function promiseTry(block: () => T | PromiseLike): Promise>;