wasm-bindgen icon indicating copy to clipboard operation
wasm-bindgen copied to clipboard

wasm_bindgen attribute shouldn't accept typescript_type without using it

Open TedDriggs opened this issue 3 years ago • 0 comments

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[]

TedDriggs avatar Apr 27 '22 19:04 TedDriggs