type-challenges
type-challenges copied to clipboard
108 - Trim
type EmptySpaces = ' ' | '\n' | '\t';
type Trim<S extends string> = S extends
| `${EmptySpaces}${infer T}`
| `${infer T}${EmptySpaces}`
? Trim<T>
: S;