Skip to content

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

Open
@upsuper

Description

@upsuper

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions