diff --git a/.changeset/chilly-hornets-type.md b/.changeset/chilly-hornets-type.md new file mode 100644 index 00000000000..157d64a3a41 --- /dev/null +++ b/.changeset/chilly-hornets-type.md @@ -0,0 +1,5 @@ +--- +"effect": patch +--- + +refactor `TrimEnd` & `TrimStart` diff --git a/packages/effect/src/String.ts b/packages/effect/src/String.ts index ab13a48abfd..440099c0728 100644 --- a/packages/effect/src/String.ts +++ b/packages/effect/src/String.ts @@ -146,11 +146,7 @@ export const trim = (self: A): Trim => self.trim() as Trim< /** * @since 2.0.0 */ -export type TrimStart = A extends ` ${infer B}` ? TrimStart - : A extends `\n${infer B}` ? TrimStart - : A extends `\t${infer B}` ? TrimStart - : A extends `\r${infer B}` ? TrimStart - : A +export type TrimStart = A extends `${" " | "\n" | "\t" | "\r"}${infer B}` ? TrimStart : A /** * @example @@ -165,11 +161,7 @@ export const trimStart = (self: A): TrimStart => self.trimS /** * @since 2.0.0 */ -export type TrimEnd = A extends `${infer B} ` ? TrimEnd - : A extends `${infer B}\n` ? TrimEnd - : A extends `${infer B}\t` ? TrimEnd - : A extends `${infer B}\r` ? TrimEnd - : A +export type TrimEnd = A extends `${infer B}${" " | "\n" | "\t" | "\r"}` ? TrimEnd : A /** * @example