摘要:
题目 中文 给定一个字符串数组, 实现它的全排列组合. English Given an array of strings, do Permutation & Combination. It's also useful for the prop types like video controlsLi 阅读全文
摘要:
题目 中文 有时我们需要限制数字的范围... 示例: type result = NumberRange<2 , 9> // | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 English Sometimes we want to limit the range of numbers 阅读全文
摘要:
题目 中文 构造一个给定长度的元组。 例如 type result = ConstructTuple<2> // 期望得到 [unknown, unkonwn] English Construct a tuple with a given length. For example type resul 阅读全文
摘要:
题目 中文 实现类型的 Lodash.uniq, Unique 接受数组 T, 返回没有重复值的数组 T English Implement the type version of Lodash.uniq, Unique takes an Array T, returns the Array T w 阅读全文
摘要:
题目 中文 实现类型的 Array.lastIndexOf, LastIndexOf<T, U> 接受泛型参数 Array T 和 any U 并返回数组 T 中最后一个 U 的索引 示例: type Res1 = LastIndexOf<[1, 2, 3, 2, 1], 2>; // 3 type 阅读全文
摘要:
题目 中文 实现类型版本的 Array.join, Join<T, U> 接受数组 T 和 string 或者 number 类型 U 作为泛型参数, 并返回 U 连接数组 T 后的字符串. English Implement the type version of Array.join, Join 阅读全文
摘要:
题目 中文 实现类型版本的 Math.trunc, 其接受一个字符串或数字作为泛型参数, 并返回移除了全部小数位部分后的整数 示例: type A = Trunc<12.34>; // 12 English Implement the type version of Math.trunc, whic 阅读全文
摘要:
题目 中文 实现一个像 Lodash.without 函数一样的泛型 Without<T, U>,它接收数组类型的 T 和数字或数组类型的 U 为参数,会返回一个去除 U 中元素的数组 T。 例如: type Res = Without<[1, 2], 1>; // expected to be [ 阅读全文
摘要:
题目 中文 Fill是 javascript 中常用的方法, 现在让我实现类型版本的 Fill Fill<T, N, Start?, End?>, 正如你看到的那样, Fill接受四个泛型参数, 其中 T 和 N 是必填参数, Start 和 End 是可选参数 这些参数的要求如下: T 必须是一个 阅读全文
摘要:
题目 中文 实现类型 AllCombinations<S>,该类型返回字符串 S 中字符的所有排列组合。 English Implement type AllCombinations<S> that return all combinations of strings which use chara 阅读全文
摘要:
题目 中文 实现类型版本的 Array.shift English Implement the type version of Array.shift For example type Result = Shift<[3, 2, 1]>; // [2, 1] 答案 type Shift<T exte 阅读全文