To force them to be type number
, all you need to do is assign them to a value of type number
. The examples you give:
let a = 0
let b = 0.0
are assigning them to values of type int
and float
respectively. To get values of type number
, construct number
objects from those values like this:
let a = A(0)
let b = B(0.0)