Type Challenges Judge

Trim Left

提出詳細

type Trimable = " " | "\n" | "\t" type TrimLeft<S extends string> = S extends `${Trimable}${infer Tail}` ? TrimLeft<Tail>:S;
提出日時2022-06-27 12:00:10
問題Trim Left
ユーザーwaki285
ステータス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'>, ''>>, ]