04803
Trim Right
type ReverseString<T extends string,U extends string=''>=T['length'] extends 0 ? U : T extends `${infer First}${infer Rest}`?ReverseString<Rest,`${First}${U}`>:U;
type TrimLeft<S extends string> = S extends `${[' ', '
', ' '][number]}${infer Rest}` ? TrimLeft<Rest> : S;
type TrimRight<S extends string> = ReverseString<TrimLeft<ReverseString<S>>>;