Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/deno/cli/js/deno.ts>transpileOnly

A modern runtime for JavaScript and TypeScript.
Go to Latest
function transpileOnly
import { transpileOnly } from "https://deno.land/x/deno@v0.30.0/cli/js/deno.ts";

Takes a set of TypeScript sources and resolves with a map where the key was the original file name provided in sources and the result contains the source and optionally the map from the transpile operation. This does no type checking and validation, it effectively "strips" the types from the file.

 const results =  await Deno.transpileOnly({
   "foo.ts": `const foo: string = "foo";`
 });

Parameters

sources: Record<string, string>

A map where the key is the filename and the value is the text to transpile. The filename is only used in the transpile and not resolved, for example to fill in the source name in the source map.

optional
options: CompilerOptions

An option object of options to send to the compiler. This is a subset of ts.CompilerOptions which can be supported by Deno. Many of the options related to type checking and emitting type declaration files will have no impact on the output.

Returns

Promise<Record<string, TranspileOnlyResult>>