tsync
A utility to generate types for other typed languages.
Currently, only typescript is supported.
Install
There are two parts to this:
-
A global CLI tool:
cargo install tsync
-
The dependency for rust projects (to use the
#[tsync]
attribute; see usage below)/// Cargo.toml tsync = "X.Y.Z"
Usage
Mark structs with #[tsync]
as below:
/// src/main.rs
use ;
Then use the tool:
And voilĂ !
/// types.d.ts
interface Book {
name: string
chapters: Array<Chapter>
}
interface Chapter {
title: string
pages: number
}
Docs
See cargo tsync --help
for more information.
Feel free to open tickets for support or feature requests.
License
This tool is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.