Description
I'm looking to supply a specific typing for parameters to the function that I'm writing in Rust and exposing to TS.
In an ideal world, I'd love for the function to accept a Vec<MyJsStruct>
where MyJsStruct
contains two String
fields, but that doesn't look like it's possible at the moment.
To step around this, I'm using JsValue
and serde_wasm_bindgen::from_value
which is working quite well. However, the generated wasm.d.ts
file types the parameter to my function as any
, which really isn't ideal when using TypeScript.
I was wondering if there's a way to annotate the function that I'm writing in order to specify the type of the parameter that it accepts, when the definition file is generated?
I can extend the definition file on the TypeScript side, but being able to do this completely in Rust would be much better.