TDBIN TypeScript Roadmap

TDBIN TypeScript Codec Specification

Status: partial implementation of [TDBIN-FUTURE-TS]; not release-conformant. Depends on: tdbin-wire-format.md, tdbin-rust-api.md, and the implementation audit.

Scope

[TDBIN-FUTURE-TS] adds a TypeScript TDBIN codec emitted by packages/typediagram from the same typeDiagram model used by Rust codegen.

The implementation lives in:

Requirements

Acceptance

Implementation Status

Pickup order

  1. Create one shared layout plan. Move record/union classification, scalar bit allocation, pointer slots, enum encoding class, list kind, and canonical manifest/hash derivation into a language-neutral converter module. Both rust-tdbin.ts and typescript-tdbin.ts consume that plan; neither emitter independently recomputes layout.
  2. Make the public value model lossless. Represent TDBIN Int as bigint through generated types and codec helpers, with explicit range checks at the i64 boundary. Treat the generated TypeScript API change from number as a deliberate breaking change and update converter fixtures accordingly.
  3. Reach layout parity. Emit inline enum-union fields and byte enum lists, one-bit scalar-option presence, semantic scalars, all list forms, nested options, records/unions, aliases, and monomorphized generics. Apply required pointer null/default behavior exactly as the wire spec states.
  4. Make schema checks automatic. Emit the compatibility-major hash beside every generated root codec and generate framed encode/decode wrappers that pass it. Test missing, wrong, append-compatible, and breaking hashes.
  5. Test generated artifacts rather than source strings alone. Generate a module from each corpus schema, compile it under strict TypeScript, execute both directions against Rust bytes in Node, and import the same built module in browser E2E. Retain source-shape assertions only as focused codegen tests.
  6. Measure shipping impact. Run the package bundle gate with the runtime and representative generated module included, record the result in the generated/CI artifact that owns bundle measurements, and keep it within the existing budget.

Completion evidence