Back to Type Challenges

README

questions/05140-medium-trunc/README.md

latest1.3 KB
Original Source
<!--info-header-start--><h1>Trunc </h1><blockquote><p>by jiangshan <a href="https://github.com/jiangshanmeta" target="_blank">@jiangshanmeta</a></p></blockquote><p><a href="https://tsch.js.org/5140/play" target="_blank"></a> </p><!--info-header-end-->

Implement the type version of Math.trunc, which takes string or number and returns the integer part of a number by removing any fractional digits.

For example:

typescript
type A = Trunc<12.34> // 12
<!--info-footer-start-->

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