Closed
Description
Hi!
At the moment it's possible to pass pretty much anything between Rust and js as a JsValue
, or using js-sys, however it would be nice to have a way to provide more detailed information in the .d.ts files.
For example, I can return an array of rust structs as Box<[JsValue]>
, which in typescript becomes any[]
. If I return js_sys::Promise
, I get Promise<any>
.
Would it be a good idea to add type parameters to the types in js-sys, so that you could return Array<SomeStruct>
in rust? Of course, js arrays can contain mixed types, but that could still be represented by Array<JsValue>
.
Would this be making things unnecessarily complex?