Trim<A>Type-level representation of trimming whitespace from both ends of a string.
Example (Trimming whitespace at the type level)
import type { String } from "effect"
type Result = String.Trim<" hello "> // "hello"models
Source effect/String.ts:2801 lines
export type type Trim<A extends string> =
TrimStart<A> extends
| `${infer B} `
| `${infer B}
`
| `${infer B}\t`
| `${infer B}\r`
? TrimEnd<B>
: TrimStart<A>
Type-level representation of trimming whitespace from both ends of a string.
Example (Trimming whitespace at the type level)
import type { String } from "effect"
type Result = String.Trim<" hello "> // "hello"
Trim<function (type parameter) A in type Trim<A extends string>A extends string> = type TrimEnd<A extends string> =
A extends
| `${infer B} `
| `${infer B}
`
| `${infer B}\t`
| `${infer B}\r`
? TrimEnd<B>
: A
Type-level representation of trimming whitespace from the end of a string.
Example (Trimming trailing whitespace at the type level)
import type { String } from "effect"
type Result = String.TrimEnd<"hello "> // "hello"
TrimEnd<type TrimStart<A extends string> =
A extends
| ` ${infer B}`
| `
${infer B}`
| `\t${infer B}`
| `\r${infer B}`
? TrimStart<B>
: A
Type-level representation of trimming whitespace from the start of a string.
Example (Trimming leading whitespace at the type level)
import type { String } from "effect"
type Result = String.TrimStart<" hello"> // "hello"
TrimStart<function (type parameter) A in type Trim<A extends string>A>>Referenced by 1 symbols