type-challenges icon indicating copy to clipboard operation
type-challenges copied to clipboard

108 - Trim

Open jakubjereczek opened this issue 2 years ago • 0 comments

type EmptySpaces = ' ' | '\n' | '\t';

type Trim<S extends string> = S extends
  | `${EmptySpaces}${infer T}`
  | `${infer T}${EmptySpaces}`
  ? Trim<T>
  : S;

jakubjereczek avatar Apr 20 '23 10:04 jakubjereczek