Absolute number as string

Medium
conditional types
template literal
infer

Description:

Implement the Absolute<T> type. A type that take string, number or bigint. The output should be a positive number (NOT string);

For example

type Test = -100 type Result = Absolute<Test> // expected to be "100"

Code

Loading...