json-schema-to-typescript is a code generator that compiles JSON Schema definitions into TypeScript type declarations.
The tool solves the problem of keeping TypeScript types synchronized with JSON Schema specifications. Rather than manually writing type definitions that match a schema, developers provide a JSON Schema file and the tool generates corresponding TypeScript interfaces and types. The generator handles complex schema features including nested objects, arrays, unions, enums, and schema references, producing valid TypeScript declaration files that can be used immediately in projects.
The tool suits projects that rely on JSON Schema as a source of truth for data validation or API contracts. It works well for teams using schemas to document APIs, configuration formats, or data structures that need corresponding TypeScript types. The CLI provides straightforward conversion of individual schema files, while the programmatic API allows integration into build pipelines. An experimental `--imports` mode enables compiling multiple related schemas together, automatically converting cross-file references into TypeScript imports rather than duplicating type definitions across output files. This is particularly useful when schemas reference shared definitions in a common file.
The project maintains active development with regular updates to handle new Node.js versions and TypeScript features. The codebase receives ongoing refinement of edge cases in schema compilation, particularly around how references and cycles are resolved. The tool includes a browser-based demo for trying conversions interactively before adopting it in a workflow.