type NonEmptyTuple<T =unknown> = readonly [T, ...T[]];
type NonEmptyTuple<T =unknown> = readonly [T, ...T[]];
import type {NonEmptyTuple} from 'type-fest';const sum = (...numbers: NonEmptyTuple<number>) => numbers.reduce((total, value) => total + value, 0);sum(1, 2, 3);// Ok// @ts-expect-errorsum();// Error: Expected at least 1 arguments, but got 0.
import type {NonEmptyTuple} from 'type-fest';const sum = (...numbers: NonEmptyTuple<number>) => numbers.reduce((total, value) => total + value, 0);sum(1, 2, 3);// Ok// @ts-expect-errorsum();// Error: Expected at least 1 arguments, but got 0.