type alias Lastimport { type Last } from "https://deno.land/x/fonction@v2.1.0-beta.4/common/mod.ts"; Infer the last types. ExamplesExample 1 // String Last<string> // string Last<''> // '' Last<'hello'> // 'o' Example 2 // Array Last<[] | never[] | readonly [] | readonly never[]> // undefined Last<['hello', 'world']> // 'world' Last<string | number[]> // string | number | undefined Type ParametersT extends string | readonly unknown[]definition: T extends string ? LastString<T> : T extends readonly [...infer _, infer L] ? L : T[T["length"]] | undefined