mirror of
https://github.com/xazukx/ts-rs.git
synced 2026-11-18 22:30:26 +00:00
update readme
This commit is contained in:
@@ -19,6 +19,29 @@ ts-rs exposes a single interface, `TS`. Using a derive macro, you can implement
|
||||
Then, you can use this trait to obtain the TypeScript bindings.
|
||||
We recommend doing this in your tests. [see the example](https://github.com/Aleph-Alpha/ts-rs/blob/main/example/src/lib.rs)
|
||||
|
||||
## get started
|
||||
```toml
|
||||
[dependencies]
|
||||
ts-rs = "0.1"
|
||||
```
|
||||
|
||||
```rust
|
||||
use ts_rs::TS;
|
||||
|
||||
#[derive(TS)]
|
||||
struct User {
|
||||
user_id: i32,
|
||||
first_name: String,
|
||||
last_name: String,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn export_ts() {
|
||||
std::fs::remove_file("bindings.ts").ok();
|
||||
User::dump("bindings.ts").unwrap();
|
||||
}
|
||||
```
|
||||
|
||||
## [example](https://github.com/Aleph-Alpha/ts-rs/blob/main/example/src/lib.rs)
|
||||
|
||||
## features
|
||||
|
||||
Reference in New Issue
Block a user