TypeScript Compiler Options

emitDeclarationOnly — TypeScript compiler option

Emits type declarations without corresponding JavaScript when declaration generation is enabled. Useful with a separate JavaScript transpiler. It still checks types unless another option alters checking; it is not equivalent to noEmit. Default: False when omitted. Create the named files in a clean local project and run tsc -p tsconfig.json. Expected emitted files: dist/example.d.ts. Inspect the output files or diagnostics; there is no runtime step for this configuration. 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": {    "emitDeclarationOnly": true  }}

Parameters & Attributes

NameTypeDescription
emitDeclarationOnlybooleanSet 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,    "emitDeclarationOnly": true  },  "files": [    "example.ts"  ]}// File: example.tsexport const count: number = 3;console.log(count);
TypeScript Reference