specta-typescript 0.0.11

Export your Rust types to TypeScript
Documentation
use specta::{ResolvedTypes, Type};
use specta_typescript::{JSDoc, Typescript};

/// Hello World
#[derive(Type)]
pub struct TypeOne {
    pub field1: String,
    pub field2: TypeTwo,
}

/// Bruh
#[derive(Type)]
#[deprecated = "bruh"]
pub struct TypeTwo {
    #[deprecated]
    pub my_field: String,
    /// Another one
    pub bruh: another::TypeThree,
}

#[derive(Type)]
pub struct ImGeneric<T> {
    pub my_field: T,
}

mod another {
    #[derive(specta::Type)]
    pub struct TypeThree {
        pub my_field: String,
    }
}

fn main() {
    let resolved_types = ResolvedTypes::from_resolved_types(specta::collect());

    Typescript::default()
        .layout(specta_typescript::Layout::Files)
        // This requires the `export` feature to be enabled on Specta
        .export_to("./bindings", &resolved_types)
        .unwrap();

    JSDoc::default()
        .layout(specta_typescript::Layout::Files)
        // This requires the `export` feature to be enabled on Specta
        .export_to("./bindings2", &resolved_types)
        .unwrap();
}