# 2693-实现EndsWith
# 题目描述
实现EndsWith<T, U>,接收两个 string 类型参数,然后判断T是否以U结尾,根据结果返回true或false
例如:
type a = EndsWith<'abc', 'bc'>; // expected to be true
type b = EndsWith<'abc', 'abc'>; // expected to be true
type c = EndsWith<'abc', 'd'>; // expected to be false
# 分析
参考上一题目 startWith。
# 题解
type EndsWith<T extends string, U extends string> = T extends `${infer F}${U}`
  ? true
  : false;
# 知识点
- 字符串匹配常量,
A extends `${infer M}111`,通过改变占位的位置即可实现多种多样的匹配