Back to Type Challenges

README.Zh CN

questions/18142-medium-all/README.zh-CN.md

latest1.6 KB
Original Source
<!--info-header-start--><h1>All </h1><blockquote><p>by cutefcc <a href="https://github.com/cutefcc" target="_blank">@cutefcc</a></p></blockquote><p><a href="https://tsch.js.org/18142/play/zh-CN" target="_blank"></a> &nbsp;&nbsp;&nbsp;<a href="./README.md" target="_blank"></a> </p><!--info-header-end-->

如果传入的第一个参数中所有元素都等于传入的第二个参数,则返回 true;如果有不匹配,则返回 false。

例如:

ts
type Test1 = [1, 1, 1]
type Test2 = [1, 1, 2]

type Todo = All<Test1, 1> // 应与 true 相同
type Todo2 = All<Test2, 1> // 应与 false 相同
<!--info-footer-start-->

<a href="../../README.zh-CN.md" target="_blank"></a> <a href="https://tsch.js.org/18142/answer/zh-CN" target="_blank"></a> <a href="https://tsch.js.org/18142/solutions" target="_blank"></a> <!--info-footer-end-->