Const
Casts a number to the Int branded type.
number
Int
Validates that the value is an integer and returns it with the Int brand. Throws a TypeError otherwise.
TypeError
The value as an Int
const branded = asInt(42);assert.isTrue(branded === 42);assert.isTrue(Int.is(branded)); Copy
const branded = asInt(42);assert.isTrue(branded === 42);assert.isTrue(Int.is(branded));
If the value is not an integer
Casts a
numberto theIntbranded type.Validates that the value is an integer and returns it with the
Intbrand. Throws aTypeErrorotherwise.