ts-utils
    Preparing search index...

    Type Alias Trim<Input, TrimmedChars>

    Trim: Input extends | `${TrimmedChars}${infer InputSubstring}`
    | `${infer InputSubstring}${TrimmedChars}`
        ? Trim<InputSubstring, TrimmedChars>
        : Input

    Takes an exact string type and returns a new string with the whitespace from both ends removed.

    Type Parameters

    • Input extends string

      The exact string type.

    • TrimmedChars extends string = Space

      A union of string chars to trim.

    type trimmed = Trim<'  Hello World  '>
    // => type trimmed = 'Hello World'