import { Maybe } from './Maybe.js'; import { Tuple } from './Tuple.js'; export type NonEmptyListCompliant = T[] & { 0: T; }; export interface NonEmptyList extends NonEmptyListCompliant { map(this: NonEmptyList, callbackfn: (value: T, index: number, array: NonEmptyList) => U, thisArg?: any): NonEmptyList; reverse(this: NonEmptyList): NonEmptyList; concat(...items: ConcatArray[]): NonEmptyList; concat(...items: (T | ConcatArray)[]): NonEmptyList; } export interface NonEmptyListTypeRef { /** Typecasts an array with at least one element into a `NonEmptyList`. Works only if the compiler can confirm that the array has one or more elements */ >(list: T): NonEmptyList; /** Returns a `Just NonEmptyList` if the parameter has one or more elements, otherwise it returns `Nothing` */ fromArray(source: readonly T[]): Maybe>; /** Converts a `Tuple` to a `NonEmptyList` */ fromTuple(source: Tuple): NonEmptyList; /** Typecasts any array into a `NonEmptyList`, but throws an exception if the array is empty. Use `fromArray` as a safe alternative */ unsafeCoerce(source: readonly T[]): NonEmptyList; /** Returns true and narrows the type if the passed array has one or more elements */ isNonEmpty(list: readonly T[]): list is NonEmptyList; /** The same function as \`List#head\`, but it doesn't return a Maybe as a NonEmptyList will always have a head */ head(list: NonEmptyList): T; /** The same function as \`List#last\`, but it doesn't return a Maybe as a NonEmptyList will always have a last element */ last(list: NonEmptyList): T; /** The same function as \`List#tail\`, but it doesn't return a Maybe as a NonEmptyList will always have a tail (although it may be of length 0) */ tail(list: NonEmptyList): T[]; } export declare const NonEmptyList: NonEmptyListTypeRef;