Back to Type Challenges

README

questions/00545-hard-printf/README.md

latest1.5 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" target="_blank"></a> &nbsp;&nbsp;&nbsp;<a href="./README.ja.md" target="_blank"></a> </p><!--info-header-end-->

Implement Format<T extends string> generic.

For example,

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.md" target="_blank"></a> <a href="https://tsch.js.org/545/answer" target="_blank"></a> <a href="https://tsch.js.org/545/solutions" target="_blank"></a> <!--info-footer-end-->