Skip to content

fix: add typeFrom support for autoimports exports generation - #3963

Merged
pi0 merged 3 commits into
nitrojs:v2from
8ctavio:fix/imports-type-from
Oct 29, 2026
Merged

pi0 merged 3 commits into
nitrojs:v2from
8ctavio:fix/imports-type-from

Conversation

@8ctavio

@8ctavio 8ctavio commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

🔗 Linked issue

#3669 part 2

❓ 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

PR #3670 added imports' typeForm support for global declarations; this PR adds typeFrom support for autoimports' export statements, so that explicit imports from #imports may also find type declarations.

Inside the writeTypes function, toExports call is updated to use imports' typeFrom property when available (see unjs/unimport#477).

📝 Checklist

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

@8ctavio
8ctavio requested a review from pi0 as a code owner January 20, 2026 22:35
@vercel

vercel Bot commented Jan 20, 2026

Copy link
Copy Markdown

@8ctavio is attempting to deploy a commit to the Nitro Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jan 20, 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: Advanced
  • Run ID: faa2d22c-458c-4453-8b99-00e86ff33439

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
  • Post copyable unit tests in a comment
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@pi0 pi0 added the v2 label Jan 21, 2026
@8ctavio

8ctavio commented Mar 15, 2026

Copy link
Copy Markdown
Contributor Author

I think changing toExports's third parameter (includeType) to true should be considered as well. Currently, the generated nitro-imports.d.ts only re-exports values. With includeType set to true, types are re-exported too, and it would be possible to import them from #imports.

@pi0x pi0x added bug Something isn't working (PRs; issues use the Bug type) types TypeScript types labels Sep 2, 2026
@pkg-pr-new

pkg-pr-new Bot commented Oct 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: e298141

@pi0
pi0 merged commit 726bd77 into nitrojs:v2 Oct 29, 2026
10 of 11 checks passed
@pi0x pi0x removed the v2 label Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working (PRs; issues use the Bug type) types TypeScript types

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants