On this page
deno transpile
The deno transpile command emits JavaScript from TypeScript, JSX, or TSX
sources. It's useful when you need plain .js output to ship to a runtime that
doesn't understand TypeScript, or to feed into a build step that expects
JavaScript.
For most workflows you do not need deno transpile — deno run,
deno test, and deno serve already accept .ts / .tsx files directly.
Reach for it when:
- You're shipping a library to consumers that run
nodeor a browser bundler directly. (For npm tarballs, preferdeno pack, which wrapsdeno transpilewith packaging logic.) - A downstream tool only understands
.js. - You want pre-compiled
.jschecked into a build artifact rather than transpiled on the fly.
Usage Jump to heading
deno transpile <files...> [flags]
<files> is one or more source file paths (globs are expanded by the shell).
deno transpile does not crawl a directory — pass the files you want
transpiled, optionally via a shell glob.
Output modes Jump to heading
| Mode | Effect |
|---|---|
| no output flag | Write the transpiled output to standard out. |
-o <path>, --output <path> |
Write the output to a single file. Conflicts with --outdir. |
--outdir <dir> |
Write each input file into <dir>, mirroring the source layout. |
# Print to stdout
deno transpile main.ts
# Write to a single file
deno transpile main.ts -o dist/main.js
# Transpile multiple files into an output directory
deno transpile src/main.ts src/helpers.ts --outdir dist
# Use a shell glob
deno transpile src/*.ts --outdir dist
Input / output extension mapping Jump to heading
| Input | Output | Source map |
|---|---|---|
.ts |
.js |
.js.map |
.tsx |
.js |
.js.map |
.jsx |
.js |
.js.map |
.mts |
.mjs |
.mjs.map |
.cts |
.cjs |
.cjs.map |
JSX transform, decorators, target, and other emit settings come from
compilerOptions in your deno.json (or tsconfig.json), so the output
matches what deno run would execute. See
TypeScript compiler options
for the full list.
Source maps Jump to heading
Pass --source-map with one of:
| Mode | Effect |
|---|---|
none |
(default) no source map |
inline |
embed the source map as a data: comment in each file |
separate |
write a sibling .js.map (or .mjs.map / .cjs.map) |
deno transpile main.ts -o dist/main.js --source-map separate
Type declarations Jump to heading
Use --declaration to emit .d.ts declaration files. Declarations are produced
by tsc (using the bundled TypeScript), so this flag honors the
compilerOptions from your deno.json / tsconfig.json.
.d.ts files are always written to disk — next to the source when no output
location is set, or into --outdir when one is supplied — even if the
JavaScript output is going to stdout or a single -o file.
deno transpile src/*.ts --outdir dist --declaration
How it differs from tsc Jump to heading
deno transpile and TypeScript's tsc overlap, but they aren't drop-in
replacements for each other:
| Concern | deno transpile |
tsc |
|---|---|---|
| Type checking | None — emit only. Use deno check separately. |
Full type checking by default. |
.d.ts generation |
Yes, with --declaration. Delegates to bundled tsc. |
Yes. |
| JSR / npm / remote imports | Resolves them. | Doesn't resolve them. |
| Config source | deno.json (or tsconfig.json). |
tsconfig.json only. |
| Speed | Fast SWC-based emit. | Slower (type-checking included). |
If you want type errors to surface, run
deno check before or after transpilation.
deno transpile will happily emit code that fails to type-check.
Caveats Jump to heading
- No bundling. Each input file produces one output file. Imports are
rewritten extension-only (
./foo.ts→./foo.js) but the resulting graph still requires a runtime that resolves the imports. For a single-file output, usedeno bundle. - No directory crawl. Passing a directory does nothing — pass the files
explicitly (
src/**/*.ts) or via a glob. - Source maps and stdout.
--source-map inlineworks when writing to stdout;separaterequires an output path it can write the map next to.
See also Jump to heading
deno bundle— produce a single bundled JavaScript filedeno pack— build an npm-publishable tarball (usesdeno transpileinternally)deno check— type-check without emitting- TypeScript support — overview of how TypeScript works in Deno
deno transpile [OPTIONS] [file]...Transpile TypeScript/JSX/TSX files to JavaScript.
deno transpile main.ts
Output to a specific file:
deno transpile main.ts -o main.js
Output to a directory:
deno transpile src/*.ts --outdir dist
With source maps:
deno transpile main.ts --source-map separate
Generate declaration files:
deno transpile main.ts -o out.js --declaration
Note: --declaration always writes .d.ts files to disk (next to the source or in --outdir).
Dependency management options Jump to heading
--frozen<BOOLEAN>optionalError out if lockfile is out of date.
Load import map file from local file or remote URL.
--lock<FILE>optionalCheck the specified lock file. (If value is not provided, defaults to "./deno.lock").
--no-lockDisable auto discovery of the lock file.
--no-npmDo not resolve npm modules.
--no-remoteDo not resolve remote modules.
--node-modules-dir<MODE>optionalSets the node modules management mode for npm packages.
--node-modules-linker<MODE>Sets the linker mode for npm packages (isolated or hoisted).
--reload, -r<CACHE_BLOCKLIST>optionalReload source code cache (recompile TypeScript) no value Reload everything jsr:@std/http/file-server,jsr:@std/assert/assert-equals Reloads specific modules npm: Reload all npm modules npm:chalk Reload specific npm module.
--vendor<vendor>optionalToggles local vendor folder usage for remote modules and a node_modules folder for npm packages.
Options Jump to heading
--cert<FILE>Load certificate authority from PEM encoded file.
--conditions<conditions>Use this argument to specify custom conditions for npm package exports. You can also use DENO_CONDITIONS env var. .
Configure different aspects of deno including TypeScript, linting, and code formatting.
Typically the configuration file will be called deno.json or deno.jsonc and
automatically detected; in that case this flag is not necessary.
--declarationGenerate .d.ts declaration files (requires type-checking via tsc).
--minimum-dependency-age<minimum-dependency-age>(Unstable) The age in minutes, ISO-8601 duration or RFC3339 absolute timestamp (e.g. '120' for two hours, 'P2D' for two days, '2025-09-16' for cutoff date, '2025-09-16T12:00:00+00:00' for cutoff time, '0' to disable).
--no-configDisable automatic loading of the configuration file.
--outdir<outdir>Output directory for transpiled files.
--output, -o<output>Output file path (for single file transpilation).
--source-map<source-map>Source map mode: none, inline, or separate.