/** * Removes the first `N` elements from an array. * * @example * * type OnlyC = DropFirst<["a", "b", "c"], 2>; // ["c"] */ export type DropFirst = Length extends N ? T : T extends [infer E1, ...infer Rest] ? DropFirst : T; /** * Can be used to filter array index types from a union of array properties. * * @example * * type OnlyItems = T extends ReadonlyArray * ? { [K in Array.Index]: T[K] }[Array.Index] * : never; */ export type Index = T extends `${number}` ? T : never; /** * Extracts the `length` of an array. If the value is not an array then the * length is `0`. * * @example * * type ArrLength = Length<["a", "b", "c"]>; // 3 */ export type Length = T extends readonly unknown[] ? T["length"] : 0; /** * Tests if a value is an array. This version provides better type inference * than `Array.isArray`. * * @example * * isArray([]); // true * isArray(12); // false */ export declare function isArray(value: T | U[]): value is U[]; /** * Sorts an array by some processor function. The processor function is called * for each element in the array and the return value is used to compared the * items using strict equality comparison. * * @example * * sortBy(["1", "5", "2", "3"], Number.parseInt); // ["1", "2", "3", "5"] */ export declare function sortBy(list: T[], callback: (item: T) => U): T[]; //# sourceMappingURL=JsArray.d.ts.map