Back to Type Challenges

README.Zh CN

questions/00533-easy-concat/README.zh-CN.md

latest2.3 KB
Original Source
<!--info-header-start--><h1>Concat </h1><blockquote><p>by Andrey Krasovsky <a href="https://github.com/bre30kra69cs" target="_blank">@bre30kra69cs</a></p></blockquote><p><a href="https://tsch.js.org/533/play/zh-CN" target="_blank"></a> &nbsp;&nbsp;&nbsp;<a href="./README.md" target="_blank"></a> <a href="./README.ja.md" target="_blank"></a> <a href="./README.ko.md" target="_blank"></a> </p><!--info-header-end-->

在类型系统里实现 JavaScript 内置的 Array.concat 方法,这个类型接受两个参数,返回的新数组类型应该按照输入参数从左到右的顺序合并为一个新的数组。

例如:

ts
type Result = Concat<[1], [2]> // expected to be [1, 2]
<!--info-footer-start-->

<a href="../../README.zh-CN.md" target="_blank"></a> <a href="https://tsch.js.org/533/answer/zh-CN" target="_blank"></a> <a href="https://tsch.js.org/533/solutions" target="_blank"></a> <hr><h3>相关挑战</h3><a href="https://github.com/type-challenges/type-challenges/blob/main/questions/03057-easy-push/README.zh-CN.md" target="_blank"></a> <a href="https://github.com/type-challenges/type-challenges/blob/main/questions/03060-easy-unshift/README.zh-CN.md" target="_blank"></a> <!--info-footer-end-->