02693-medium-endswith

Back

type EndsWith<T extends string, U extends string> = T extends `${infer First}${U}` ? true : false;

Solution by ZhipengYang0605 #33111

// your answers
type EndsWith<T extends string, U extends string> =  T extends `${infer R}${U}` ? true : false

Solution by pea-sys #32889

type EndsWith<T extends string, U extends string> = T extends `${infer _}${U}` ? true : false

Solution by dev-hobin #32494

type EndsWith<T extends string,U extends string> = T extends `${infer f}${U}`? true : false

Solution by rkamely #32067

T extends `${infer P}${U}` ? true:false

Solution by Zhen-code #31802

type EndsWith<T extends string, U extends string> = T extends `${infer T}${U}`
  ? true
  : false;

Solution by vipulpathak113 #31720

// your answers

type EndsWith<T extends string, U extends string> = T extends `${string}${U}` ? true : false;

Solution by sunvictor #31649

type EndsWith<T extends string, U extends string> = T extends `${string}${U}` ? true : false;


Solution by kai-phan #30837

type EndsWith<T extends string, U extends string> = T extends `${infer Rest}${U}` ? true : false

Solution by maximallain #30556

// your answers
type EndsWith<T extends string, U extends string> = T extends `${infer First}${U}` ? true : false

Solution by eodnjs467 #29678

复用已有的ReplaceAll

type EndWith<T extends string, E extends string> = T extends `${infer R}${E}` ? true : false;
type a1 = EndWith<"abcd", "cd">;

Solution by sundial-dreams #29483

// your answers

type EndsWith<T extends string, U extends string> = T extends `${string}${U}` ? true : false 

Solution by kerolossamir165 #28925

type EndsWith<T extends string, U extends string> = T extends ${string}${U} ? true : false;

Solution by DoubleWoodLin #28691

type EndsWith<T extends string, U extends string> = T extends `${infer A}${U}` ? true : false;

Solution by hajeonghun #28674

// your answers
// ============= Your Code Here =============
type EndsWith<T extends string, U extends string> = U extends ''
? true
: T extends `${infer R}${U}` ? true : false;

Solution by ixiaolong2023 #27799

type EndsWith<T extends string, U extends string> = T extends `${string}${U}` ? true : false

Solution by jjswifty #27625

// your answers
type EndsWith<T extends string, U extends string> = T extends `${infer L}${U}` ? true : false;

Solution by GreattitJY #27592

// your answers
type EndsWith<T extends string, U extends string> = T extends `${infer String}${U}` ? true : false

Solution by daiki-skm #27337

type EndsWith<T extends string, U extends string> = T extends `${infer F}${U}` ? true : false;

Solution by 8471919 #27256

type EndsWith<T extends string, U extends string> = T extends `${string}${U}` ? true : false

Solution by RainbowIsPerfect #26999

type EndsWith<T extends string, U extends string> = T extends `${string}${U}` ? true : false

Solution by smileboyi #26916

type EndsWith<T extends string, U extends string> = T extends `${infer _}${U}` ? true : false;

Solution by rldnd #26854

type EndsWith<T extends string, U extends string> = T extends `${infer _}${U}`
  ? true
  : false;

Solution by ryuji-1to #26818

type EndsWith<T extends string, U extends string> = T extends `${infer F}${U}`
  ? true
  : false;

Solution by ZhipengYang0605 #26634

type EndsWith<T extends string, U extends string> = T extends `${infer _}${U}`
  ? true
  : false

Solution by HaoxueAllen #26509

type EndsWith<T extends string, U extends string> = T extends `${string}${U}` ? true : false;

Solution by kakasoo #26325

type EndsWith<T extends string, U extends string> = T extends `${infer L}${U}`? true: false

Solution by isntkyu #26031

type EndsWith<T extends string, U extends string> = T extends `${infer rest}${U}` ? true : false;

Solution by jsujeong #25954

// your answers
type EndsWith<T extends string, U extends string> = T extends `${infer R}${U}` ? true : false

Solution by CheolMinBae #25815

// your answers
type EndsWith<T extends string, U extends string> = T extends `${infer Rest}${U}` ? true : false

Solution by rayjayjin #25758