获得徽章 0
做ts类型体操简单题,easy-includes写了半天只能写出一个过测试的
type Intersection<T, U> = (<P>() => P extends T ? true : false) extends <
P
>() => P extends U ? true : false
? true
: false;
type Includes<T extends readonly any[], U> = T extends [infer P, ...infer K]
? Intersection<P, U> extends true
? true
: Includes<K, U>
: false;
有更优解么展开41
做ts类型体操简单题,easy-includes写了半天只能写出一个过测试的