| Crates.io | gear-mesh-generator |
| lib.rs | gear-mesh-generator |
| version | 0.1.0 |
| created_at | 2025-12-28 03:50:57.435198+00 |
| updated_at | 2025-12-28 03:50:57.435198+00 |
| description | TypeScript code generator for gear-mesh |
| homepage | https://github.com/UtakataKyosui/GearMesh |
| repository | https://github.com/UtakataKyosui/GearMesh |
| max_upload_size | |
| id | 2008199 |
| size | 49,499 |
TypeScript code generator for gear-mesh.
This crate converts Rust type definitions (represented as GearMeshType) into TypeScript code, including interfaces, Zod schemas, and Branded Types.
gear-mesh-generator provides:
bigint for large integer typesThis crate is typically used through the main gear-mesh crate, but can be used directly:
use gear_mesh_generator::{GeneratorConfig, TypeScriptGenerator};
use gear_mesh_core::GearMeshType;
let config = GeneratorConfig::new()
.with_bigint(true)
.with_zod(true)
.with_validation(true);
let generator = TypeScriptGenerator::new(config);
let typescript_code = generator.generate(&my_type);
GeneratorConfig::new()
.with_bigint(true) // Use bigint for u64/i64
.with_zod(true) // Generate Zod schemas
.with_validation(true) // Include validation rules
.with_branded(true) // Generate Branded Types
.with_jsdoc(true) // Include JSDoc comments
export interface User {
id: number;
name: string;
email: string;
}
export const UserSchema = z.object({
id: z.number(),
name: z.string().min(1).max(20),
email: z.string().email(),
});
type Brand<T, B> = T & { readonly __brand: B };
export type UserId = Brand<number, "UserId">;
export const UserId = (value: number): UserId => value as UserId;
The generator consists of several modules:
typescript.rs - TypeScript interface generationvalidation_gen.rs - Zod schema generationbranded.rs - Branded Type generationutils.rs - Utility functions for type checkingLicensed under either of:
at your option.