/** * An array of type T that is guaranteed not to be empty. */ export declare type NonEmpty = [T, ...T[]]; /** * Helper normalizing handling/converting from an T[] to NonEmpty. * * @example * const ids: string[] = []; * const results: string[] = ifEmpty( * ids, * () => [], * (ids) => ids.map((id) => `hello-${id}`) * ); * * @param arr An array that may or may not be empty. * @param then_ Called if `arr` is empty. * @param else_ Called if `arr` is not empty with a properly typed `NonEmpty`. */ export declare const ifEmpty: (arr: T[], then_: () => U, else_: (nonEmptyArr: NonEmpty) => U) => U; /** * Verifies an array has at least one element. * * @param arr An array that may or may not be empty. * @param [emptyErrorMessage] Error message when array is empty. Default message is 'Unexpected empty array.'. */ export declare const assertNotEmpty: (arr: T[], emptyErrorMessage?: string) => NonEmpty;