Trim Left
提出詳細
type TrimLeft<S extends string> = S extends `${infer First}${infer Rest}` ? First extends ' ' | '\n' | '\t' ? TrimLeft<Rest> : S : '';
提出日時 | 2023-08-10 08:36:08 |
---|---|
問題 | Trim Left |
ユーザー | tekihei2317 |
ステータス | Accepted |
import type { Equal, Expect } from '@type-challenges/utils' type cases = [ Expect<Equal<TrimLeft<'str'>, 'str'>>, Expect<Equal<TrimLeft<' str'>, 'str'>>, Expect<Equal<TrimLeft<' str'>, 'str'>>, Expect<Equal<TrimLeft<' str '>, 'str '>>, Expect<Equal<TrimLeft<' \n\t foo bar '>, 'foo bar '>>, Expect<Equal<TrimLeft<''>, ''>>, Expect<Equal<TrimLeft<' \n\t'>, ''>>, ]