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

(Partially) generate Rust type & function declarations from TypeScript type definiton file or JSDoc #18

Closed
adiba opened this issue Feb 12, 2018 · 6 comments

Comments

@adiba
Copy link

adiba commented Feb 12, 2018

Of course this does not work for some types..
This might belong in another repo.

@alexcrichton
Copy link
Contributor

Nah definitely! I could totally see something like

wasm_bindgen_typescript!("foo.d.ts");

being used

@adiba
Copy link
Author

adiba commented Feb 12, 2018

I thought of it as a separate nodejs tool since the Typescript parser is a node module. I could attempt writing a provisional script, but I know nothing about macros... yet.

@adiba
Copy link
Author

adiba commented Feb 12, 2018

TypeScript also has modules and interfaces, which could be directly translated to Rust modules and traits with ease, so support for these would be great.

@alexcrichton
Copy link
Contributor

Yeah I'm not sure what the best way to do this would be. I'd naively prefer to start off with a syn-based parser (just in the procedural macro itself) rather than picking up a dependendy through node, but I'm not sure how easily that'll work.

Alternatively there could be a JS tool which takes a foo.d.ts and emits a foo.rs with #[wasm_bindgen] anntoations maybe

@adiba adiba changed the title (Partially) generate Rust type & function declarations from TypeScript type definiton file (Partially) generate Rust type & function declarations from TypeScript type definiton file or JSDoc Feb 17, 2018
@alexcrichton
Copy link
Contributor

This is similar to https://github.com/alexcrichton/wasm-bindgen/issues/42 as well

@alexcrichton
Copy link
Contributor

Experimental support for this is now in the repository and future work is tracked with a label, so I'm gonna close this for now

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

2 participants