TypeScript Compiler Options

downlevelIteration — TypeScript compiler option

Uses iterator-aware helpers for selected iteration operations when lowering to ES5. String iteration can preserve Unicode code points when Symbol.iterator exists, unlike a simple code-unit index loop. The helper is not a Symbol.iterator polyfill; custom iterable behavior requires runtime iterator support. Modern targets generally retain native iteration. 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: '2'. 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": {    "downlevelIteration": true  }}

Parameters & Attributes

NameTypeDescription
downlevelIterationbooleanSet in compilerOptions; default: false.

Working Example

Example Snippettypescript
// File: tsconfig.json (omit this label){  "compilerOptions": {    "target": "ES5",    "module": "CommonJS",    "strict": true,    "types": [],    "noEmitOnError": true,    "outDir": "dist",    "downlevelIteration": true  },  "files": [    "example.ts"  ]}// File: example.tsconst chars: string[] = [];for (const char of "A😀") chars.push(char);console.log(chars.length);
TypeScript Reference