tsify
tsify copied to clipboard
Tsify without wasm_bindgen
Hello, I was just wondering if it's possible to decouple this from wasm_bindgen
.
I understand that the original purpose of the library was to focus on wasm_bindgen
but I was wondering if this could become a more generalised library for creating cross-language type definitions, similar to https://github.com/1Password/typeshare
Judging from the readme, the intent seems to be that this library is used with wasm bindgen
https://github.com/madonoharu/tsify#crate-features
If you put a "web"
feature in your crate, you can do
#[cfg(feature = "web")]
use tsify::Tsify;
#[cfg(feature = "web")]
use wasm_bindgen::prelude::*
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "web", derive(Tsify))]
pub struct MyStruct {
...
}
then compile with wasm-bindgen
and copy out the types. Not exactly what you want, but you can maintain a non-wasm version of your crate.