You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using Rust together with Javascript, one common way of doing so is by using wasm-bindgen.
However, wasm-bindgen does not recommend using the default serde approach for converting Rust to Javascript. Instead they recommend using serde-wasm-bindgen. This is also the first recommended approach in their documentation.
The problem is that serde-wasm-bindgen does a few things rather differently. For example, Rust HashMaps are turned into Javascript Maps This, of course, doesn't line up with what the typeshare crate offers.
For completeness sake, there's a smaller, less maintained crate that seems to be able to generate the correct types when using serde-wasm-bindgen https://github.com/madonoharu/tsify
The text was updated successfully, but these errors were encountered:
Then I'll look forward to what you'll do in the future, and for now either
use the default Serde JSON approach together with this library
or maintain Typescript types by hand
FWIW you (and anyone else coming across this issue) might want to look into tsify which supports generating TS defintiions and works in conjunction with serde-wasm-bindgen.
When using Rust together with Javascript, one common way of doing so is by using wasm-bindgen.
However, wasm-bindgen does not recommend using the default serde approach for converting Rust to Javascript. Instead they recommend using serde-wasm-bindgen. This is also the first recommended approach in their documentation.
The problem is that serde-wasm-bindgen does a few things rather differently. For example, Rust HashMaps are turned into Javascript Maps This, of course, doesn't line up with what the typeshare crate offers.
Sadly the lovely developers of serde-wasm-bindgen have deemed generating Typescript as "out of scope", hence I'm opening an issue here.
I wanted to ask if it would be in-scope to support that use-case? Or if I should raise an issue elsewhere.
For completeness sake, there's a smaller, less maintained crate that seems to be able to generate the correct types when using serde-wasm-bindgen https://github.com/madonoharu/tsify
The text was updated successfully, but these errors were encountered: