interface IArray { /** * Shuffle an array * @param array * @returns Shuffled array */ shuffle: (array: T[]) => T[]; /** * Get a random element from an array * @param array * @returns Random element from array */ random: (array: T[]) => T; /** * Clone an array * @param array * @returns Cloned array */ clone: (array: T[]) => T[]; /** * Easy sort an array * * To sort an array of primitives, use `array.sort()` * * It will error if the array is not an array, or if the key does not exist on the object or if the key is not a string or if the element is not an object when a key is provided. * * Sorting of primitives requires no key to be provided. * @param array * @param {keyof T} key - Key to sort by, or undefined/null to sort primitives * @param order * @returns Sorted array */ sort: (array: T[], key: K, order?: "asc" | "desc") => T[]; } declare class TArray implements IArray { shuffle(array: T[]): T[]; random(array: T[]): T; clone(array: T[]): T[]; sort(array: T[], key?: K | null, order?: "asc" | "desc"): T[]; } export { type IArray, TArray };