/** * Flattens an array up to the specified depth. * * @template T - The type of elements within the array. * @template D - The depth to which the array should be flattened. * @param {T[]} arr - The array to flatten. * @param {D} depth - The depth level specifying how deep a nested array structure should be flattened. Defaults to 1. * @returns {Array>} A new array that has been flattened. * * @example * const arr = flatten([1, [2, 3], [4, [5, 6]]], 1); * // Returns: [1, 2, 3, 4, [5, 6]] * * const arr = flatten([1, [2, 3], [4, [5, 6]]], 2); * // Returns: [1, 2, 3, 4, 5, 6] */ declare function flatten(arr: readonly T[], depth?: D): Array>; export { flatten };