type alias Headimport { type Head } from "https://deno.land/x/fonction@v2.1.0-beta.4/common/mod.ts"; Infer the head types. ExamplesExample 1 // String Head<string> // string Head<''> // '' Head<'hello'> // 'h' Example 2 // Array Head<[] | never[] | readonly [] | readonly never[]> // undefined Head<['hello', 'world']> // 'hello' Head<string | number[]> // string | number | undefined Type ParametersT extends readonly unknown[] | stringdefinition: T extends string ? T extends `${infer F}${string}` ? F : T extends "" ? "" : string : T extends readonly [infer U, ...infer _] ? U : T[0] | undefined