Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tsify without wasm_bindgen #13

Open
Alfred-Mountfield opened this issue Dec 15, 2022 · 2 comments
Open

Tsify without wasm_bindgen #13

Alfred-Mountfield opened this issue Dec 15, 2022 · 2 comments

Comments

@Alfred-Mountfield
Copy link

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

@stefnotch
Copy link

Judging from the readme, the intent seems to be that this library is used with wasm bindgen

https://github.com/madonoharu/tsify#crate-features

@siefkenj
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants