| Crates.io | macroforge_ts_macros |
| lib.rs | macroforge_ts_macros |
| version | 0.1.72 |
| created_at | 2025-12-07 21:43:03.180859+00 |
| updated_at | 2026-01-05 05:46:45.072527+00 |
| description | Derive macros for TypeScript compile-time code generation |
| homepage | https://github.com/macroforge-ts/macros |
| repository | https://github.com/macroforge-ts/macros |
| max_upload_size | |
| id | 1972291 |
| size | 32,162 |
Derive macros for TypeScript compile-time code generation
This crate provides procedural macros for generating TypeScript macro infrastructure in the Macroforge ecosystem. It simplifies the creation of derive macros that can transform TypeScript classes at compile time.
The primary macro provided is [ts_macro_derive], which transforms a Rust function
into a fully-fledged TypeScript macro that integrates with the Macroforge runtime.
use macroforge_ts_macros::ts_macro_derive;
#[ts_macro_derive(Debug, description = "Generates debug formatting")]
fn debug_macro(input: TsStream) -> Result<TsStream, MacroError> {
// Transform the input TypeScript class
Ok(input)
}
This generates:
Macroforge] traitinventoryThe generated code follows this pattern:
Macroforge traitinventory crateAdd this to your Cargo.toml:
[dependencies]
macroforge_ts_macros = "0.1.38"
ts_macro_derive - A procedural macro attribute that transforms a function into a TypeScript derive macro.See the full API documentation on the Macroforge website.
MIT