-
Notifications
You must be signed in to change notification settings - Fork 26
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
Initial draft of adding TypeScript types #181
Conversation
tsify might be another option to look into. |
eea95c0
to
f983a71
Compare
Force pushed to use the latest main branch HEAD as a base. The originial edits of this PR remain unchanged. |
Thanks! I'l ltry to get back to this one within the next week :) |
I'm marking this ready for review, as I think I've got it to the point where it seems to 1) work, and 2) is producing verifiably useful improvements! There are definitely still some more TODOs in terms of type mapping to TS, but as web isn't a core focus area for any of the core devs, I think we can merge this sooner to start getting the benefits and improve TS defs gradually over time (I can open an issue if you guys agree). |
This draft PR is based on the other PR I have now.
This draft is incomplete and and further discussion is needed.
In the latest commit of this PR/branch, the crate
ts-rs
is used to generate TypeScript type declarations from serde macros. Upstream git repo is used instead of the crates.io releases due to some features not yet available in the releases. (see Aleph-Alpha/ts-rs#316)The generated type declarations are not yet well integrated with wasm-pack artifacts, and function types still use
any
. Additionally, to generate the type declarations, you need to runcargo test
before runningwasm-pack
.