This crate is designed as a teaching tool for writing a Rust to Typescript type conversion utility.
It supports very basic types like primitives, structs and enums. It is not meant for production usage.
It will output a warning message for unsupported types and simply ignore them.
cargo install typester
typester --input=path/to/rustfile.rs --output=path/to/tsfile.ts
For more information use:
typester --help
```rust type NumberAlias = i32;
enum Colour { Red(i32), Green(i32), Blue(i32), }
struct Person { name: String, age: u32, enjoys_coffee: bool, }
struct ComplexType {
colourmap: HashMap
```ts
type HashSet
export type NumberAlias = number;
export type Colour = | { t: "Red"; c: number } | { t: "Green"; c: number } | { t: "Blue"; c: number };
export interface Person { name: string; age: number; enjoys_coffee: boolean; }
export interface ComplexType {
colourmap: HashMap