That looks very promising. I think we'd probably want to flag the
presence of varargs with a separate function signature altogether,
such as Module.ccall_vararg(), to avoid any overhead to non-vararg
function calls (Module.cwrap() and Module.ccall() can be very on a
performance sensitive path).
In several different places in Emscripten toolchain, there already
exists these kind of "signature strings", where a single character
denotes the return type for multiple parameters. See e.g.
https://github.com/kripken/emscripten/blob/master/src/library_gl.js#L1024.
For example, a signature string "vii" would be a function taking two
32-bit integers (or pointers), and returning a void. I think same
signature string style could be used here, except that the first
character would not denote a return value, and the signature string
would only specify the varargs portion of the parameters, the
non-varargs portion is not needed.
Perhaps regex/globbing style * and + characters could be used to
denote a variable number trail. E.g. a string "iiif*" would denote
that the varargs part would have three 32-bit integers first, and
after that, 0-N single-precision floats. A string "ffd+" would say two
single-precision floats, followed by 1-N double-precision floats. This
would allow requiring one to start crafting strings that have as many
f's or d's as there are parameters in the input array. This way one
could be explicit about whether "iii" means exactly three, or 2-N, or
3-N, or 4-N.
If you're interested in championing this further, it would be best to
continue in a GitHub PR with work towards tests and patches.