Expand description
Ferrotype: Rust-to-TypeScript type generation via derive macro
This crate provides traits and derive macros for generating TypeScript type definitions from Rust structs and enums using an intermediate representation for deduplication and dependency ordering.
§Core Design
The core abstraction is the TS trait, modeled after serde’s Serialize.
Rather than returning strings directly, it returns a TypeDef intermediate
representation that can be:
- Rendered to TypeScript syntax
- Analyzed for type dependencies
- Deduplicated for cleaner output
- Extended for additional targets
Re-exports§
pub use linkme;
Structs§
- Field
- A field in an object type.
- Type
Param - A type parameter for generic type definitions.
- Type
Registry - A registry for collecting and managing TypeScript type definitions.
Enums§
- Literal
- A literal TypeScript type with a specific value.
- Primitive
- Primitive TypeScript types.
- TypeDef
- Intermediate representation for TypeScript types.
Statics§
- TYPESCRIPT_
TYPES - Distributed slice for auto-registration of TypeScript types.
Traits§
- TS
- The core trait for types that can be represented as TypeScript.
- Type
Script Deprecated - Deprecated: Use
TSinstead.
Functions§
- extract_
object_ fields - Extracts fields from an Object TypeDef, unwrapping Named if necessary.
- inline_
typedef - Extracts the inner type definition, unwrapping Named if necessary.
Derive Macros§
- TS
- Derive macro for generating TypeScript type definitions from Rust types.
- Type
Script - Deprecated: Use
#[derive(TS)]instead.