Type Challenges Judge

Trim Left

提出詳細

type TrimTarget = " " | "\n" | "\t" type TrimLeft<T extends string> = T extends `${TrimTarget}${infer Tail}` ? TrimLeft<Tail> : T
提出日時2023-05-03 00:59:05
問題Trim Left
ユーザーDowanna
ステータス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'>, ''>>, ]