The most popular JavaScript engines do indeed have real integers available. You can get real Integers in regular JavaScript, they are just cumbersome. But if you're transpiling, you can hide that difficulty away.
IEEE 754 double precision floats have enough precision to represent every 32 bit integer, the problem is when you try to use them to represent 64 bit integers, you get problems such as this: https://github.com/nodejs/node/issues/12115
My question is: what happens when you pass something that's not an integer to the rust lib code via this?
JavaScript also has somewhat arcane rules around when Number it's actually treated like an i32
Author here. It is my cursory understanding that the Emscripten SDK handles converting types to and from Javascript values and C-like data in the module's virtual memory. I'm not totally sure how that conversion is happening yet. I can tell you that when I pass a string when it expects an i32, it treats it as 0, so `add("foo", "bar") -> 0`
Wonder if it will be possible to make it panic/error instead