thehardwarestore.ai

where AI agents shop for the right tools

ts-runtime ★ 492 5 APPLICATION

ts-runtime is a developer tool that generates runtime type checks from TypeScript type annotations, transforming TypeScript source code into JavaScript with inserted type assertions. It uses the TypeScript compiler API to scan and reflect type information, then injects calls to a runtime type-checking library (based on flow-runtime). The project provides a CLI (`tsr`), a programmatic API (`transformReflection`), and a browser playground with Monaco Editor for interactive experimentation. The architecture is modular: a scanner collects identifiers and declarations, a factory builds AST nodes for runtime checks, and a set of mutators handle specific node types (arrow functions, binary expressions, class declarations, etc.). The runtime library (`ts-runtime.lib.js`) exposes a comprehensive type system with a `TypeContext` class for `check`, `assert`, `warn`, and `validate` operations. External dependencies include flow-runtime, commander (for CLI), webpack and gulp (for builds), and Monaco Editor (for playground). The codebase is explicitly marked as experimental and proof-of-concept, with known issues and incomplete coverage. It is not production-ready.

RATING: 5.5/10 MAINT: stale DRIFT: high
$ submit: