vexil-codegen-ts
TypeScript code generation backend for the Vexil schema compiler.
Takes a CompiledSchema from vexil-lang and emits TypeScript interfaces, encode functions, and decode functions. Generated code depends on @vexil-lang/runtime for bit-level I/O.
Single file
use compile;
use generate;
let result = compile;
let compiled = result.compiled.expect;
let code: String = generate?;
Multi-file project
use ;
use TypeScriptBackend;
let project = compile_project?;
let files: = TypeScriptBackend.generate_project?;
// one .ts file per schema + barrel index.ts files for namespace directories
What gets generated
For each message: a TypeScript interface, an encode* function, and a decode* function. Enums become string literal union types. Flags become numeric constants with bitwise helpers. Unions become discriminated unions. For @delta messages: a stateful encoder/decoder class pair.
Cross-file imports use relative paths. Namespace directories get barrel index.ts files that re-export their contents.
Wire compatibility
Generated TypeScript produces byte-identical output to the Rust backend. This is verified by the compliance vector suite.
License
Licensed under either of MIT or Apache-2.0 at your option.