String: Trim

Medium
conditional types
template literal
infer
recursive

Description:

Implement Trim<T> which takes an exact string type and returns a new string with the whitespace from both ends removed.

For example

type trimmed = Trim<' Hello World '> // expected to be 'Hello World'

Code

Loading...