denoland/deno · error

No declaration file emitted for entry point

Error message

No declaration file emitted for entry point: {}

What it means

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.

Solutions

  1. Make the entrypoint a TypeScript file so a declaration is emitted for it
  2. Ensure the entry's types are locally resolvable (inline or relative .d.ts), not remote-only
  3. If it persists with a plain TS entry, minimize the repro and file a deno issue — this is a mapping invariant

Example fix

# before
# entry is plain JS, no declaration emitted
deno bundle ./main.js

# after
# rename/convert the entry to TypeScript
deno bundle ./main.ts
Defensive patterns

Strategy: validation

Validate before calling

// Before bundling with declaration output, confirm the entry is TypeScript
const entry = "./main.ts";
if (!/\.(ts|mts|cts|tsx)$/.test(entry)) {
  throw new Error("entry must be TypeScript for .d.ts emission");
}

Prevention

When it happens

Trigger: 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).

Common situations: Bundling a JavaScript entry while expecting type output; entries whose types come from `@types` or remote declaration files rather than local sources.

Related errors


AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20). Data as JSON: /api/errors/2d0da6d04b08fd43. Report an issue: GitHub.

Appendix: source

Thrown at cli/tools/bundle/mod.rs:503

      dts_by_source.insert(source_path, content.clone());
    }
  }

  // For each entry point, produce a single rolled-up .d.ts
  for entry_specifier in &entrypoint_specifiers {
    let entry_path = entry_specifier.to_file_path().map_err(|_| {
      deno_core::anyhow::anyhow!(
        "Entry point must be a file: {}",
        entry_specifier
      )
    })?;

    // Find the .d.ts for this entry point
    let dts_path = to_dts_path(&entry_path);
    let entry_dts = dts_by_source
      .get(&dts_path.to_string_lossy().to_string())
      .ok_or_else(|| {
        deno_core::anyhow::anyhow!(
          "No declaration file emitted for entry point: {}",
          entry_specifier
        )
      })?;

    // Flatten: resolve all `export ... from "..."` re-exports by inlining
    // the referenced declarations from other .d.ts files.
    let flattened =
      flatten_declarations(entry_dts, &entry_path, &dts_by_source);

    // Determine output path for the rolled-up .d.ts
    let dts_output_path = if let Some(ref output) = bundle_flags.output_path {
      let js_path = init_cwd.join(output);
      to_dts_path(&js_path)
    } else if let Some(ref outdir) = bundle_flags.output_dir {
      let outdir = PathBuf::from(outdir);
      let stem = entry_path.file_stem().unwrap_or_default();
      outdir.join(format!("{}.d.ts", stem.to_string_lossy()))

View on GitHub (pinned to 9ad36f7a2c)