Skip to content

fix(types): emit auto-import paths as files, not directories#4334

Merged
pi0 merged 1 commit into
nitrojs:v2from
danielroe:fix/deno-types-v2
Jun 10, 2026
Merged

fix(types): emit auto-import paths as files, not directories#4334
pi0 merged 1 commit into
nitrojs:v2from
danielroe:fix/deno-types-v2

Conversation

@danielroe

Copy link
Copy Markdown
Member

🔗 Linked issue

remake of #4333 for v2

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

duplicate description for posterity:

writeTypes emits const foo: typeof import('<path>').foo per auto-imported binding

for some packages, the path ends up being the package directory rather than a file; this works fine for TypeScript with moduleResolution: bundler, but Deno's TS host doesn't apply Node directory resolution to relative specifiers and bails

this PR treats ./ the same as an empty subpath & falls back to resolvedPath, which ends up having its extension stripped

both typescript + deno should resolve this equally well.

note: packages with different exports.types vs exports.imports (eg #2384) won't work correctly, either before or after this fix (but the error slightly changes 😆)

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroe danielroe requested a review from pi0 as a code owner June 10, 2026 16:20
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2a08b4fd-fd49-42e1-8d4a-3529d26df3b7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new

pkg-pr-new Bot commented Jun 10, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/nitropack@4334

commit: cc69ec9

@pi0 pi0 merged commit 51e5229 into nitrojs:v2 Jun 10, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants