ExportType

Derive Macro ExportType 

Source
#[derive(ExportType)]
{
    // Attributes available to this derive:
    #[export_type]
}
Expand description

Derives the ExportType trait for a struct or enum, generating TypeScript type definitions.

§Examples

#[derive(ExportType)]
#[export_type(lang = "typescript", path = "types/generated")]
struct User {
    id: i32,
    name: String,
    #[export_type(rename = "emailAddress")]
    email: Option<String>,
}

#[derive(ExportType)]
enum Status {
    Active,
    Inactive,
    Pending { reason: String },
}