Crate ferro_type

Crate ferro_type 

Source
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.
TypeParam
A type parameter for generic type definitions.
TypeRegistry
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.
TypeScriptDeprecated
Deprecated: Use TS instead.

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.
TypeScript
Deprecated: Use #[derive(TS)] instead.