Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions runtime/_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ export const sidebar = [
title: "deno test",
href: "/runtime/reference/cli/test/",
},
{
title: "deno transpile",
href: "/runtime/reference/cli/transpile/",
},
{
title: "deno types",
href: "/runtime/reference/cli/types/",
Expand Down
2 changes: 2 additions & 0 deletions runtime/reference/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ below for more information on each subcommand.
- [deno lsp](/runtime/reference/cli/lsp/) - language server protocol integration
- [deno publish](/runtime/reference/cli/publish/) - publish a module to JSR
- [deno test](/runtime/reference/cli/test/) - run your tests
- [deno transpile](/runtime/reference/cli/transpile/) - transpile TypeScript,
JSX, or TSX to JavaScript
- [deno types](/runtime/reference/cli/types/) - print runtime types
- [deno upgrade](/runtime/reference/cli/upgrade/) - upgrade Deno to the latest
version
Expand Down
90 changes: 90 additions & 0 deletions runtime/reference/cli/transpile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
last_modified: 2026-05-20
title: "deno transpile"
command: transpile
openGraphLayout: "/open_graph/cli-commands.jsx"
openGraphTitle: "deno transpile"
description: "Transpile TypeScript, JSX, or TSX to JavaScript"
---

The `deno transpile` command emits JavaScript from TypeScript, JSX, or TSX
sources. It is useful when you need plain `.js` output to ship to a runtime that
does not 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.

## Usage

```sh
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

- **stdout** (default): write the transpiled output to standard out.
- **single file** with `-o <path>`: write the output to `<path>`. Conflicts with
`--outdir`.
- **directory** with `--outdir <dir>`: write the output of each input file into
`<dir>`, mirroring the source layout.

```sh
# 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

| 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, and other emit settings come from `compilerOptions`
in your `deno.json` (or `tsconfig.json`), so the output matches what `deno run`
would execute.

### Source maps

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`) |

```sh
deno transpile main.ts -o dist/main.js --source-map separate
```

### Type declarations

Use `--declaration` to emit `.d.ts` declaration files. Declarations are produced
by `tsc`, 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.

```sh
deno transpile src/*.ts --outdir dist --declaration
```