// Gets the first element of an array: https://lodash.com/docs/4.17.15#head. // type S = Head<[1, 2, 3]>; // 1 // // If `T` is of type array and has at least one element, return it. Otherwise, // return `never`: export type Head> = // Check if it extends an array with at least one item: T extends [any, ...Array] ? T['0'] : never;