Skip to content

fix(resolver): fall back to execution if can't resolve types - #31507

Merged
nathanwhit merged 3 commits into
denoland:mainfrom
nathanwhit:fix-manual-types-bug
Dec 5, 2025
Merged

nathanwhit merged 3 commits into
denoland:mainfrom
nathanwhit:fix-manual-types-bug

Conversation

@nathanwhit

Copy link
Copy Markdown
Member

Fixes #31352

This matches the behavior of the other node_modules_dir modes more closely as well as tsc's behavior. Failing to find types should not be an error

@nathanwhit
nathanwhit requested a review from dsherret December 5, 2025 18:58
@coderabbitai

coderabbitai Bot commented Dec 5, 2025 •

Copy link
Copy Markdown

Walkthrough

Adds a fallback in resolve_req_with_sub_path_inner: if a types-resolution attempt (initially using NodeResolutionKind::Types) fails indicating types were not found, the resolver retries normal package subpath resolution using NodeResolutionKind::Execution (guarded by a debug_assert that the initial kind was Types). Adds a test scenario under tests/specs/check/nmd_manual_no_types/ including __test__.jsonc, deno.json, and main.ts to exercise resolving an npm package without type definitions. No public API signatures were changed.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed Title clearly summarizes the main change: adding a fallback to execution when type resolution fails in the resolver.
Description check ✅ Passed Description explains the fix, references the linked issue, and clarifies the behavior change aligns with other modes and tsc.
Linked Issues check ✅ Passed The code changes directly address issue #31352 by implementing a fallback mechanism when type resolution fails, preventing errors during deno check.
Out of Scope Changes check ✅ Passed All changes are in scope: resolver logic update and test files to validate the new fallback behavior for missing types.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6c549ea and 2543c35.

📒 Files selected for processing (1)
  • libs/resolver/npm/mod.rs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • libs/resolver/npm/mod.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: test release linux-x86_64
  • GitHub Check: test debug linux-x86_64
  • GitHub Check: test debug linux-aarch64
  • GitHub Check: test debug windows-x86_64
  • GitHub Check: test debug macos-x86_64
  • GitHub Check: test debug macos-aarch64
  • GitHub Check: build libs
  • GitHub Check: lint debug linux-x86_64
  • GitHub Check: lint debug windows-x86_64
  • GitHub Check: lint debug macos-x86_64

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.

@dsherret dsherret left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. There's a separate bug here where we surface this as a hard error instead of a typescript diagnostic (edit: #31509)

Comment thread libs/resolver/npm/mod.rs Resolved
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.

Failed resolving types for @babel/core

2 participants