Type Challenges Judge

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>>, ]