Back to Type Challenges

README

questions/00459-medium-flatten/README.md

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

In this challenge, you would need to write a type that takes an array and emitted the flatten array type.

For example:

ts
type flatten = Flatten<[1, 2, [3, 4], [[[5]]]]> // [1, 2, 3, 4, 5]
<!--info-footer-start-->

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