import { type LastArrayElement } from "https://deno.land/x/actionify@0.3.0/src/deps/types.ts";
Extracts the type of the last element of an array.
Use-case: Defining the return type of functions that extract the last element of an array, for example lodash.last
.
definition: ValueType extends readonly [infer ElementType] ? ElementType : ValueType extends readonly [infer _, ...infer Tail] ? LastArrayElement<Tail> : ValueType extends ReadonlyArray<infer ElementType> ? ElementType : never