Skip to content

Commit

Permalink
Add generated type to README (#365)
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavo-shigueo authored Nov 3, 2024
1 parent 592898a commit 0ff3c81
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ struct User {
last_name: String,
}
```
When running `cargo test` or `cargo test export_bindings`, the TypeScript bindings will be exported to the file `bindings/User.ts`.

When running `cargo test` or `cargo test export_bindings`, the TypeScript bindings will be exported to the file `bindings/User.ts`
and will contain the following code:

```ts
export type User = { user_id: number, first_name: string, last_name: string, };
```

### Features
- generate type declarations from rust structs
Expand Down
8 changes: 7 additions & 1 deletion ts-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,13 @@
//! last_name: String,
//! }
//! ```
//! When running `cargo test` or `cargo test export_bindings`, the TypeScript bindings will be exported to the file `bindings/User.ts`.
//!
//! When running `cargo test` or `cargo test export_bindings`, the TypeScript bindings will be exported to the file `bindings/User.ts`
//! and will contain the following code:
//!
//! ```ts
//! export type User = { user_id: number, first_name: string, last_name: string, };
//! ```
//!
//! ## Features
//! - generate type declarations from rust structs
Expand Down

0 comments on commit 0ff3c81

Please sign in to comment.