StartsWith
提出詳細
type StartsWith<T extends string, U extends string> = T extends `${U}${infer Rest}` ? true : false
| 提出日時 | 2024-09-10 16:31:10 | 
|---|---|
| 問題 | StartsWith | 
| ユーザー | ookkoouu | 
| ステータス | Accepted | 
import type { Equal, Expect } from '@type-challenges/utils' type cases = [ Expect<Equal<StartsWith<'abc', 'ac'>, false>>, Expect<Equal<StartsWith<'abc', 'ab'>, true>>, Expect<Equal<StartsWith<'abc', 'abcd'>, false>>, Expect<Equal<StartsWith<'abc', ''>, true>>, Expect<Equal<StartsWith<'abc', ' '>, false>>, ]