Back to Type Challenges

README

questions/00531-medium-string-to-union/README.md

latest1.7 KB
Original Source
<!--info-header-start--><h1>String to Union </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/531/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-->

Implement the String to Union type. Type take string argument. The output should be a union of input letters

For example

ts
type Test = "123"
type Result = StringToUnion<Test> // expected to be "1" | "2" | "3"
<!--info-footer-start-->

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