Type of elements in the iterable
A function that takes an iterable and returns its first element
// Get first element without sorting
const firstElement = first()([3, 1, 4, 2, 5])
// Result: 3
// Get first element after sorting (ascending)
const firstSorted = first((a: number, b: number) => a - b)([3, 1, 4, 2, 5])
// Result: 1
Creates a function that returns the first element from an iterable, with optional sorting. If a comparator is provided, sorts the values before returning the first element. Otherwise, returns the first element from the values in their original order.