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

Update README.md with struct compilation from Rust to Typescript example #361

Open
monstaflame opened this issue Oct 18, 2024 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@monstaflame
Copy link

monstaflame commented Oct 18, 2024

I've just discovered this nice crate. There is one thing that made me pause, there is no example of Typescript that the crate would generate.

My suggestion / request is adding the example below in the README.md (I'm taking the current content of the section and add what I would like to add) :

use ts_rs::TS;

#[derive(TS)]
#[ts(export)]
struct User {
   user_id: i32,
   first_name: String,
   last_name: String,
}

When running cargo test, the TypeScript bindings will be exported to the file bindings/User.ts.

interface User {
   userId: number,
   firstName: string,
   lastName: string,
}

Something like that.

@gustavo-shigueo gustavo-shigueo added the documentation Improvements or additions to documentation label Oct 18, 2024
@NyxCode
Copy link
Collaborator

NyxCode commented Oct 19, 2024

Maybe we can (also?) commit the bindings generated by the example?

@monstaflame
Copy link
Author

Yes it would be great !

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

No branches or pull requests

3 participants