TypeScript Compiler Options

declarationMap — TypeScript compiler option

Generates a map linking a declaration file to its originating TypeScript source. Tools can use it for source navigation when the original files are available; it is distinct from JavaScript debugging maps. Requires declaration generation (including through composite). Default: False when omitted. Create the named files in a clean local project and run tsc -p tsconfig.json. Expected emitted files: dist/example.js, dist/example.d.ts, dist/example.d.ts.map. Run node dist/example.js; expected stdout: '3'. Tested with TypeScript 5.8.3 and Node.js 22.16.0; local project example, not a single-file editor.

Formal Syntax & Structure

typescript syntaxtypescript
{  "compilerOptions": {    "declarationMap": true  }}

Parameters & Attributes

NameTypeDescription
declarationMapbooleanSet in compilerOptions; False when omitted.

Working Example

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