TypeScript Compiler Options
emitBOM — TypeScript compiler option
Writes a UTF-8 byte order mark (EF BB BF) at the start of generated text output when requested. This is a byte-level output setting, not a source encoding conversion or a runtime feature. Choose it only for consumers that need a BOM. Default: false. Create the named files in a clean local project. Run tsc -p tsconfig.json. Expected output files: dist/example.js. Run node dist/example.js; expected stdout: '3'. 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": { "emitBOM": true }}Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| emitBOM | boolean | Set in compilerOptions; default: false. |
Working Example
Example Snippettypescript
// File: tsconfig.json (omit this label){ "compilerOptions": { "target": "ES2022", "module": "CommonJS", "strict": true, "types": [], "noEmitOnError": true, "outDir": "dist", "emitBOM": true }, "files": [ "example.ts" ]}// File: example.tsexport const count: number = 3;console.log(count);