#[ts]Expand description
Generates TypeScript interface bindings from a Rust struct.
This attribute works identically to the upstream ts-macro attribute, allowing
the struct to define a TypeScript interface with property bindings seamlessly
mapped to Javascript functions.
It generates:
- A TypeScript interface string exposed as a custom wasm section
- Extensible bindings and trait implementations
The default behavior for field names is to convert to camelCase for Javascript conventions.
However, you can opt-out by adding rename_all = "none":
ⓘ
#[ts(rename_all = "none")]
struct MyStruct {
my_field_name: String, // Will remain "my_field_name" in TypeScript
}