Skip to content

wasm_bindgen attribute shouldn't accept typescript_type without using it #2874

@TedDriggs

Description

@TedDriggs

Describe the Bug

The #[wasm_bindgen] attribute accepts (some?) fields without error, but doesn't use them.

Steps to Reproduce

#[wasm_bindgen]
pub struct MyStruct {
    hello: String,
}

#[wasm_bindgen]
impl MyStruct {
    #[wasm_bindgen(getter, typescript_type = "Thing[]")]
    pub things(&self) -> Vec<JsValue> {
        todo!()
    }
}

Expected Behavior

Either the return type of the getter would be Thing[] or the macro would have produced an error on the attempt to use typescript_typethere.

Actual Behavior

The typescript_type field will be ignored, and the getter will have a return type of any[]

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