Add<A
, B
>: _Add_
<A
, B
>
Addition of two positive integer values represented by either a number or a string format
Requires
TypeScript 4.8+
Remarks
The operation doesn't have any noticeable limitations
Example
const smallValue: MathUtils.Add<3, 4> = 7;
const bigValue: MathUtils.Add<9999999, 9999999> = 19999998;
const stringArgs: MathUtils.Add<'1234567890', '987654321'> = 2222222211;
Name | Type | Description |
---|---|---|
A |
extends string | number |
any positive integer number |
B |
extends string | number |
any positive integer number |
Multiply<A
, B
>: _Multiply_
<A
, B
>
Multiplies two positive integer values represented by either a number or a string format
Requires
TypeScript 4.8+
Remarks
The first argument can be 999 max because of a hardcoded limit in TypeScript compiler
Example
const numberArgs: MathUtils.Multiply<78, 63> = 4914;
const stringArgs: MathUtils.Multiply<'999', '999'> = 998001;
Name | Type | Description |
---|---|---|
A |
extends string | number |
any positive integer number from 0 to 999 |
B |
extends string | number |
any positive integer number |
Parse<T
>: T
extends number
? T
: T
extends `${infer N extends number}` ? N
: never
Returns number by the given string representation
Requires
TypeScript 4.8+
Remarks
Example
const intValue: MathUtils.Parse<'123'> = 123;
const floatValue: MathUtils.Parse<'-56.78'> = -56.78;
const stringArg: MathUtils.Parse<123> = 123;
Name | Type | Description |
---|---|---|
T |
extends string | number |
any number |