Skip to content

TypeScript type for number slices parameters should accept array of number #4504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
upsuper opened this issue May 5, 2025 · 0 comments
Open
Labels

Comments

@upsuper
Copy link

upsuper commented May 5, 2025

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.

@upsuper upsuper added the bug label May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant