TypeScript Compiler Options

importHelpers — TypeScript compiler option

Imports needed downlevel helpers from tslib in module files rather than duplicating their definitions in each file. A compatible tslib package must resolve at build time and runtime. Global scripts do not become modules merely because this option is enabled. This does not polyfill runtime APIs. Default: false. Create the named files in a clean local project. Install tslib@2.8.1 in the local project before compiling and running. Run tsc -p tsconfig.json. Expected output files: dist/example.js. Run node dist/example.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": {    "importHelpers": true  }}

Parameters & Attributes

NameTypeDescription
importHelpersbooleanSet 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",    "importHelpers": true  },  "files": [    "example.ts"  ]}// File: example.tsexport const result = { ...{ count: 3 }, extra: 4 };console.log(result.count + result.extra);
TypeScript Reference