{"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/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/tools/bundle/mod.rs#L485-L521","documentation":"After a bundle with declaration emission, Deno looks up the `.d.ts` that was emitted for each entrypoint (mapping the entry source path to its declaration path). If the emitted-declarations map has no entry for that path, this error fires: no rolled-up `.d.ts` can be produced for the entry.","triggerScenarios":"The entrypoint emitted no declaration file — e.g. a plain `.js` entry with no types, declarations resolved to a remote `.d.ts` only, or an entry path whose `to_dts_path` mapping doesn't match what was emitted (unusual extensions, renamed outputs).","commonSituations":"Bundling a JavaScript entry while expecting type output; entries whose types come from `@types` or remote declaration files rather than local sources.","solutions":["Make the entrypoint a TypeScript file so a declaration is emitted for it","Ensure the entry's types are locally resolvable (inline or relative .d.ts), not remote-only","If it persists with a plain TS entry, minimize the repro and file a deno issue — this is a mapping invariant"],"exampleFix":"# before\n# entry is plain JS, no declaration emitted\ndeno bundle ./main.js\n\n# after\n# rename/convert the entry to TypeScript\ndeno bundle ./main.ts","handlingStrategy":"validation","validationCode":"// Before bundling with declaration output, confirm the entry is TypeScript\nconst entry = \"./main.ts\";\nif (!/\\.(ts|mts|cts|tsx)$/.test(entry)) {\n  throw new Error(\"entry must be TypeScript for .d.ts emission\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use a TS entry when declaration output is expected","Keep the entry's types locally resolvable rather than remote-only","Minimize the entry to confirm the mapping before reporting"],"tags":["bundle","typescript","declarations","entrypoint"],"backgroundTag":"missing-declaration-output","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}