TypeScript Compiler Options

newLine — TypeScript compiler option

Selects the emitted line ending sequence. It affects generated text rather than the meaning of the program. Specify LF or CRLF explicitly for reproducible output when required; do not assume the setting rewrites original source files. Default: LF on the tested host. 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": {    "newLine": "crlf"  }}

Parameters & Attributes

NameTypeDescription
newLine"lf" | "crlf"Set in compilerOptions; default: LF on the tested host.

Working Example

Example Snippettypescript
// File: tsconfig.json (omit this label){  "compilerOptions": {    "target": "ES2022",    "module": "CommonJS",    "strict": true,    "types": [],    "noEmitOnError": true,    "outDir": "dist",    "newLine": "crlf"  },  "files": [    "example.ts"  ]}// File: example.tsexport const count: number = 3;console.log(count);
TypeScript Reference