Type Challenges Judge

EndsWith

提出詳細

type EndsWith<T extends string, U extends string> = T extends `${string}${U}` ? true:false;
提出日時2022-06-28 05:24:30
問題EndsWith
ユーザーwaki285
ステータス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>>, ]