TypeScript Transpile Only CLI
typescript-transpile-only (version 0.0.4) is a command-line interface utility that wraps the TypeScript compiler (`tsc`) to perform transpilation without type checking. Its primary purpose is to allow developers to convert TypeScript code into JavaScript, enforcing only syntax correctness while ignoring semantic (type) errors. This tool is particularly useful for projects undergoing a gradual migration from JavaScript to TypeScript, or for teams where immediate resolution of all type errors is not feasible or desired, enabling a softer transition. The package's author notes it was a "1 hour hack," indicating a minimal development effort and implying an irregular or non-existent release cadence. Its key differentiator is this focused `transpile-only` behavior without the complexities or overhead of full `tsc` type-checking, enabling a softer transition path for projects with existing type errors.
Common errors
-
Unknown option: --build
cause Attempting to use `tsc` specific flags, such as `--build`, that are not implemented or supported by `tsc-transpile-only`.fixConsult the `typescript-transpile-only` documentation for supported flags. For `--build`, you will need to invoke `tsc-transpile-only` for each project directory individually. -
Error: Cannot find module 'typescript' or Error: Cannot find 'typescript'
cause The `typescript` package, which is a peer dependency, is not installed alongside `typescript-transpile-only`.fixInstall `typescript` in your project: `npm install typescript`. -
Process exited with code 1 (when expecting a specific `tsc` error code)
cause `tsc-transpile-only` uses a generic exit code of 1 for all failures (syntax errors), unlike `tsc` which provides more specific non-zero error codes.fixModify your shell scripts or CI/CD configurations to check for a generic exit code of 1 for any failure, rather than relying on specific `tsc` error codes.
Warnings
- gotcha The package author explicitly states this is a "1 hour hack" with "No tests" and recommends using it "at your own risk." It may not be suitable for production-critical workflows or environments requiring high stability.
- breaking Several standard `tsc` CLI flags, including `--build`, `--help`, `--version`, and `--all`, are not supported by `tsc-transpile-only`.
- gotcha Exit codes for `tsc-transpile-only` do not align with `tsc`'s detailed error codes. It uses exit code 1 for all failures (e.g., syntax errors) and 0 for success, rather than specific codes for different failure reasons.
Install
-
npm install typescript-transpile-only -
yarn add typescript-transpile-only -
pnpm add typescript-transpile-only
Quickstart
npm install typescript-transpile-only npm install typescript # Run the transpile-only compiler on your project tsc-transpile-only --project . # Example: Transpile a single file # tsc-transpile-only my-file.ts --outDir dist # Example: To replicate a --build like behavior for multiple projects # tsc-transpile-only --project ./packages/my-lib # tsc-transpile-only --project ./packages/my-app