aboutsummaryrefslogtreecommitdiff
path: root/docs/DEVELOPMENT.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/DEVELOPMENT.md')
-rw-r--r--docs/DEVELOPMENT.md20
1 files changed, 20 insertions, 0 deletions
diff --git a/docs/DEVELOPMENT.md b/docs/DEVELOPMENT.md
index 58714a09..8dbb1cea 100644
--- a/docs/DEVELOPMENT.md
+++ b/docs/DEVELOPMENT.md
@@ -158,6 +158,26 @@ else {
```
+### Auto-generating TypeScript bindings for Rust types
+
+This codebases uses [`ts-rs`](https://crates.io/crates/ts-rs) to generate TypeScript interfaces from Rust code.
+
+To generate new bindings, [use the appropriate macros](https://docs.rs/ts-rs/6.2.1/ts_rs/#get-started)
+
+```Rust
+use ts_rs::TS;
+
+#[derive(TS)]
+#[ts(export)]
+struct User {
+ user_id: i32,
+ first_name: String,
+ last_name: String,
+}
+```
+
+then simply run `cargo test`. The generated bindings are placed in `src-tauri/bindings/`. Make sure to add and commit them as well!
+
## Other
This repo uses [EditorConfig](https://editorconfig.org/) to define some basic formatting rules. Find a plugin for your IDE [here](https://editorconfig.org/#download).