Back to Type Challenges

README.Ja

questions/00949-medium-anyof/README.ja.md

latest1.9 KB
Original Source
<!--info-header-start--><h1>AnyOf </h1><blockquote><p>by null <a href="https://github.com/kynefuk" target="_blank">@kynefuk</a></p></blockquote><p><a href="https://tsch.js.org/949/play/ja" target="_blank"></a> &nbsp;&nbsp;&nbsp;<a href="./README.md" target="_blank"></a> <a href="./README.zh-CN.md" target="_blank"></a> <a href="./README.ko.md" target="_blank"></a> </p><!--info-header-end-->

Pythonの any 関数のような型を実装してください。実装する型は配列を受け取り、その配列のいずれかの要素が真ならば true を返します。なお、受け取った配列が空配列の場合は false を返します。

例えば:

ts
type Sample1 = AnyOf<[1, "", false, [], {}]> // expected to be true.
type Sample2 = AnyOf<[0, "", false, [], {}]> // expected to be false.
<!--info-footer-start-->

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