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
... by implementing `UserId` as an example, on both the Rust and the
TypeScript sides, since it's one of the simplest packets.
`tsify-next` is used with `wasm-bindgen` for bindgen. One alternative
that has been considered is using pure `wasm-bindgen`, but that does not
support Rust-style `enum`s. We could use `serde-wasm-bindgen` to
overcome that limitation, but doing so requires that we return
`JsValue`s on the wasm-js boundary, which prevents strong typing and
`.d.ts` generation. To return our `struct`s directly, we have to
implement `IntoWasmAbi` and other traits manually, which is not quite
ergonomic, and still does not allow `.d.ts` generation. `tsify-next`
helps generate those trait implementations, as well as the `.d.ts` file,
so it's considered the best solution at present.
Note that `tsify-next` is a successor of `tsify`. The latter has been
unmaintained for over 1.5 years at the time of this commit. We could
switch to `tsify` if it gets updated in the future.
Furthermore, if `wasm-bindgen` adds support for Rust-style `enum`s, we
could stop using `tsify-next` (see ref for the tracking issue).
`ts-rs` has also been considered, but it does not generate the
`wasm-bindgen::convert` traits, and generates each `struct`s and `enum`s
into their own `.d.ts` files, which is quite messy.
Ref: rustwasm/wasm-bindgen#2407
0 commit comments