Back to Type Challenges

README

questions/00476-extreme-sum/README.md

latest1.4 KB
Original Source
<!--info-header-start--><h1>Sum </h1><blockquote><p>by null <a href="https://github.com/uid11" target="_blank">@uid11</a></p></blockquote><p><a href="https://tsch.js.org/476/play" target="_blank"></a> </p><!--info-header-end-->

Implement a type Sum<A, B> that summing two non-negative integers and returns the sum as a string. Numbers can be specified as a string, number, or bigint.

For example,

ts
type T0 = Sum<2, 3> // '5'
type T1 = Sum<'13', '21'> // '34'
type T2 = Sum<'328', 7> // '335'
type T3 = Sum<1_000_000_000_000n, '123'> // '1000000000123'
<!--info-footer-start-->

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