declare class SortedArrayImpl { #private; constructor(compare: Cmp, ...values: T[]); static from(compare: Cmp, source: Iterable): SortedArrayImpl; add(...values: T[]): void; delete: (...indices: number[]) => T[]; clear(): void; every: (predicate: (value: T, index: number, array: SortedArray) => unknown, thisArg?: any) => boolean; filter: (predicate: (value: T, index: number, array: SortedArray) => unknown, thisArg?: any) => SortedArray; find: (predicate: (value: T, index: number, obj: SortedArray) => unknown, thisArg?: any) => T | undefined; findIndex: (predicate: (value: T, index: number, obj: SortedArray) => unknown, thisArg?: any) => number; forEach: (callbackfn: (value: T, index: number, array: SortedArray) => void, thisArg?: any) => void; includes: (searchElement: T, fromIndex?: number | undefined) => boolean; indexOf: (searchElement: T, fromIndex?: number | undefined) => number; join: (separator?: string | undefined) => string; lastIndexOf: (searchElement: T, fromIndex?: number | undefined) => number; map: (callbackfn: (value: T, index: number, array: SortedArray) => unknown, thisArg?: any) => unknown[]; pop: () => T | undefined; reduce: (callbackfn: (previousValue: unknown, currentValue: T, currentIndex: number, array: SortedArray) => unknown, initialValue: unknown) => unknown; reduceRight: (callbackfn: (previousValue: unknown, currentValue: T, currentIndex: number, array: SortedArray) => unknown, initialValue: unknown) => unknown; shift: () => T | undefined; slice: (start?: number | undefined, end?: number | undefined) => SortedArray; some: (predicate: (value: T, index: number, array: SortedArray) => unknown, thisArg?: any) => boolean; at: any; get length(): number; [Symbol.iterator](): IterableIterator; } /** * Sorted array. Behaves much like a regular array but its elements remain * sorted using the `compare` function supplied in the constructor. * * Contains most of the methods defined on regular JavaScript arrays as long as * they don't modify the array's content in place. * * New elements are added using the `add(...values)` method. * * Elements can still be accessed using bracket notation as in plain JavaScript * arrays but can't be assigned to using bracket notation (as that could change * the element's sort position). * * Elements can be removed using the `delete(...indices)` method, which returns * an array containing the deleted values. * Deleting an element using `delete sorted[index]` will also work, but results * in a TypeScript error because element access is marked readonly. * * Array methods that pass a reference of the array to a callback (e.g. `map`, * `reduce`, `find`) will pass a reference to the SortedArray instance instead. * * The `filter` and `slice` methods will return SortedArray instances instead of * plain arrays. */ export interface SortedArray extends SortedArrayImpl { readonly [K: number]: T; } declare const _default: (new (compare: Cmp, ...value: T[]) => SortedArray) & { from: typeof SortedArrayImpl.from; }; export default _default; declare type Cmp = (a: T, b: T) => number;