EndsWith
提出詳細
type EndsWith<T extends string, U extends string> = T extends `${infer _}${U}` ? true : false
提出日時 | 2023-08-13 09:26:11 |
---|---|
問題 | EndsWith |
ユーザー | tekihei2317 |
ステータス | Accepted |
import type { Equal, Expect } from '@type-challenges/utils' type cases = [ Expect<Equal<EndsWith<'abc', 'bc'>, true>>, Expect<Equal<EndsWith<'abc', 'abc'>, true>>, Expect<Equal<EndsWith<'abc', 'd'>, false>>, ]