TypeScript Compiler Options

outFile — TypeScript compiler option

Combines emitted global scripts into a single output file in program order. With external modules, only AMD and System module formats support this option; it is not a general CommonJS or ES module bundler. Use a bundler for modern application bundles. Default: unset. Create the named files in a clean local project. Run tsc -p tsconfig.json. Expected output files: dist/bundle.js. Run node dist/bundle.js; expected stdout: '7'. Tested using TypeScript 5.8.3 and Node.js 22.16.0; local project instructions, not a single-file editor.

Formal Syntax & Structure

typescript syntaxtypescript
{  "compilerOptions": {    "outFile": "dist/bundle.js"  }}

Parameters & Attributes

NameTypeDescription
outFileoutput file pathSet in compilerOptions; default: unset.

Working Example

Example Snippettypescript
// File: tsconfig.json (omit this label){  "compilerOptions": {    "target": "ES2022",    "module": "None",    "strict": true,    "types": [],    "noEmitOnError": true,    "outFile": "dist/bundle.js"  },  "files": [    "first.ts",    "second.ts"  ]}// File: first.tsconst base = 4;// File: second.tsconsole.log(base + 3);
TypeScript Reference