wasm-bindgen
wasm-bindgen copied to clipboard
TypeScript type for number slices parameters should accept array of number
For Rust type like Box<[u32]> in parameter, wasm-bindgen generates Uint32Array as type in the TypeScript declaration. However, the glue code generated uses TypedArray.set internally to pass the content into the linear memory, and that method actually accepts array of number as well.
Having the type being only TypedArray forces consumer to create an extra TypedArray and copy content into it first, which should be unnecessary.