# @runtime-type-inspector/transpiler

> Validating JSDoc types at runtime for high-quality types - Trust is good, control is better.

Latest version **5.0.0** (published 2026-09-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @runtime-type-inspector/transpiler
pnpm add @runtime-type-inspector/transpiler
yarn add @runtime-type-inspector/transpiler
bun add @runtime-type-inspector/transpiler
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 5.0.0 |
| Published | 2026-09-24 |
| First published | 2023-11-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Hermann Rolfes |
| Maintainers | kungfooman |

## Links

- npm: https://www.npmjs.com/package/@runtime-type-inspector/transpiler
- Repository: https://github.com/kungfooman/RuntimeTypeInspector.js
- Homepage: https://github.com/kungfooman/RuntimeTypeInspector.js#readme
- Issues: https://github.com/kungfooman/RuntimeTypeInspector.js/issues
- npm.io page: https://npm.io/package/@runtime-type-inspector/transpiler

## Recent versions

- 5.0.0 (latest) — 2026-09-24
- 4.0.6 — 2025-02-15
- 4.0.5 — 2025-02-14
- 4.0.4 — 2025-02-13
- 4.0.3 — 2024-11-16
- 4.0.2 — 2024-11-15
- 4.0.1 — 2024-11-06
- 4.0.0 — 2024-07-22
- 3.3.7 — 2024-06-21
- 3.3.6 — 2024-06-20
- 3.3.5 — 2024-06-19
- 3.3.4 — 2024-06-17
- 3.3.3 — 2024-06-17
- 3.3.2 — 2024-06-14
- 3.3.1 — 2024-06-14
- … 45 more at https://npm.io/package/@runtime-type-inspector/transpiler/versions

## README

Transpiler package for `runtime-type-inspector`.

This is implementing the source code transformation, generating code eventually executed in combination with `@runtime-type-inspector/runtime`.

## CLI

After installing, two commands are available via `npx`:

- `transpiler <file.js>` - insert runtime type-checking assertions for the JSDoc types in a file.
- `ts2js <file.ts>` - convert a TypeScript file into plain ESM JavaScript with the types preserved as JSDoc comments (no transpilation step needed afterwards).

## `ts2js`

Converts TypeScript into `.js` + JSDoc. Type-only imports become `@import` comments
(`import type {Foo} from './foo'` -> `/** @import { Foo } from './foo.js' */`), so no
runtime import is emitted. The common TypeScript surface is covered (functions,
interfaces/aliases, enums, generics, classes including `implements`, unions, tuples,
rest params, TSX, `import = require`); `namespace` blocks are converted to the classic
IIFE pattern (`var N; (function (N) { ... })(N || (N = {}));`). See `test/ts2js.mjs`
for the exact snapshot coverage.

The conversion preserves types but does not verify them - runtime validation is still
provided by `@runtime-type-inspector/runtime` via `addTypeChecks`.

---
_Source: https://npm.io/package/@runtime-type-inspector/transpiler · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
