Back to Type Challenges

README.Ja

questions/00545-hard-printf/README.ja.md

latest1.6 KB
Original Source
<!--info-header-start--><h1>printf </h1><blockquote><p>by null <a href="https://github.com/Bestmain-YS" target="_blank">@Bestmain-YS</a></p></blockquote><p><a href="https://tsch.js.org/545/play/ja" target="_blank"></a> &nbsp;&nbsp;&nbsp;<a href="./README.md" target="_blank"></a> </p><!--info-header-end-->

汎用的なFormat<T extends string>を実装します。

例えば、

ts
type FormatCase1 = Format<'%sabc'>; // FormatCase1 : string => string
type FormatCase2 = Format<'%s%dabc'>; // FormatCase2 : string => number => string
type FormatCase3 = Format<'sdabc'>; // FormatCase3 :  string
type FormatCase4 = Format<'sd%abc'>; // FormatCase4 :  string
<!--info-footer-start-->

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