{"record":{"id":"2d0da6d04b08fd43","repo":"denoland/deno","slug":"no-declaration-file-emitted-for-entry-point","errorCode":null,"errorMessage":"No declaration file emitted for entry point: {}","messagePattern":"No declaration file emitted for entry point: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/tools/bundle/mod.rs","lineNumber":503,"sourceCode":"      dts_by_source.insert(source_path, content.clone());\n    }\n  }\n\n  // For each entry point, produce a single rolled-up .d.ts\n  for entry_specifier in &entrypoint_specifiers {\n    let entry_path = entry_specifier.to_file_path().map_err(|_| {\n      deno_core::anyhow::anyhow!(\n        \"Entry point must be a file: {}\",\n        entry_specifier\n      )\n    })?;\n\n    // Find the .d.ts for this entry point\n    let dts_path = to_dts_path(&entry_path);\n    let entry_dts = dts_by_source\n      .get(&dts_path.to_string_lossy().to_string())\n      .ok_or_else(|| {\n        deno_core::anyhow::anyhow!(\n          \"No declaration file emitted for entry point: {}\",\n          entry_specifier\n        )\n      })?;\n\n    // Flatten: resolve all `export ... from \"...\"` re-exports by inlining\n    // the referenced declarations from other .d.ts files.\n    let flattened =\n      flatten_declarations(entry_dts, &entry_path, &dts_by_source);\n\n    // Determine output path for the rolled-up .d.ts\n    let dts_output_path = if let Some(ref output) = bundle_flags.output_path {\n      let js_path = init_cwd.join(output);\n      to_dts_path(&js_path)\n    } else if let Some(ref outdir) = bundle_flags.output_dir {\n      let outdir = PathBuf::from(outdir);\n      let stem = entry_path.file_stem().unwrap_or_default();\n      outdir.join(format!(\"{}.d.ts\", stem.to_string_lossy()))","sourceCodeStart":485,"sourceCodeEnd":521,"githubUrl":"https://github.com/denoland/deno/blob/89f33cbef296a2b287f323d42de54c871fa69c77/cli/tools/bundle/mod.rs#L485-L521","documentation":"After tsc emits declarations, the emitted files are indexed by source path and each entrypoint looks up its expected .d.ts (to_dts_path, cli/tools/bundle/mod.rs:498-507). This error means no emitted declaration matched the entry - most commonly because the entrypoint is JavaScript (tsc emits .d.ts for TS sources under these settings) or produced no emitted output at all.","triggerScenarios":"'deno bundle --declaration app.js ...' where the entry is .js/.mjs (no declaration emitted for it); a TS entry that is type-only and yields no emitted .d.ts; emitted keys failing to map back through the file:// path index (unusual path casing/symlinks).","commonSituations":"Projects with a JS entry adding --declaration late; mixed JS/TS codebases bundling the JS entry; entries that only re-export types.","solutions":["Make the entrypoint a TypeScript module (.ts/.mts/.tsx) - declarations are emitted for TS sources","If the entry only re-exports types, convert it to TS so tsc emits a .d.ts for it","Verify with 'deno check <entry>' that the entry itself type-checks and has emittable contents","If a plain TS entry still hits this on current Deno, report it - the emitted-file indexing may have a path-mapping bug"],"exampleFix":"// before: JS entry - no .d.ts emitted for it\n// app.js: export function add(a, b) { return a + b; }\n// run: deno bundle --declaration app.js --outdir dist  -> error\n// after: TS entry\n// app.ts: export function add(a: number, b: number): number { return a + b; }\n// run: deno bundle --declaration app.ts --outdir dist","handlingStrategy":"validation","validationCode":"# Verify the entry is a TypeScript source before --declaration bundling\ncase \"$1\" in *.ts|*.mts|*.cts|*.tsx) ;; *) echo 'declaration emission requires a TS entrypoint'; exit 2;; esac\ndeno bundle --declaration \"$1\" --outdir dist","typeGuard":"const TS_EXTENSIONS = ['.ts', '.mts', '.cts', '.tsx'] as const;\nfunction isTsEntrypoint(path: string): boolean {\n  return TS_EXTENSIONS.some((ext) => path.toLowerCase().endsWith(ext));\n}","tryCatchPattern":null,"preventionTips":["Convert JS entries to TS when declaration artifacts are needed","Check that entries export runtime values (type-only entries may emit nothing)","Smoke-test 'deno bundle --declaration' in CI so entry drift is caught early"],"tags":["bundle","declarations","javascript","typescript"],"backgroundTag":null,"analyzedSha":"89f33cbef296a2b287f323d42de54c871fa69c77","analyzedAt":"2026-08-16T07:54:21.310Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}