Skip to content

feat: add TypeScript resolveRoot option#111

Merged
chenjiahan merged 3 commits into
mainfrom
david/feat-typescript-resolve-root
Jun 25, 2026
Merged

feat: add TypeScript resolveRoot option#111
chenjiahan merged 3 commits into
mainfrom
david/feat-typescript-resolve-root

Conversation

@Timeless0911

Copy link
Copy Markdown
Member

Summary

This PR adds typescript.resolveRoot so projects can choose the root used to resolve the default TypeScript package without hard-coding typescriptPath. It applies to normal TypeScript loading, TypeScript 7+ tsgo auto-detection, and the native-preview fallback, while explicit typescriptPath continues to take precedence.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Timeless0911, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 46 minutes and 6 seconds. Learn how PR review limits work.

To continue reviewing without waiting, enable usage-based billing in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9ab66cd5-4806-4d70-9062-8b0ddba245ea

📥 Commits

Reviewing files that changed from the base of the PR and between 6986d23 and 16636cd.

📒 Files selected for processing (1)
  • src/typescript/type-script-worker-config.ts
📝 Walkthrough

Walkthrough

The PR adds resolveRoot to TypeScript worker options and config types, documents the option in the README, updates TypeScript package resolution to use an optional root path, and adds tests covering root-based resolution and TypeScript Go detection.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding the TypeScript resolveRoot option.
Description check ✅ Passed The description accurately matches the changes by explaining resolveRoot, tsgo auto-detection, and precedence over typescriptPath.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch david/feat-typescript-resolve-root

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
test/unit/typescript/type-script-worker-config.spec.ts (1)

43-78: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a resolveRoot test for the native-preview fallback.

The new suite covers default typescript resolution and TS 7 auto-detection, but it never exercises the tsgo: true fallback through resolveDefaultPreviewPackageJsonPath(options.resolveRoot). A small @typescript/native-preview fixture (or a parameterized package helper) plus a { tsgo: true, resolveRoot } case would lock down the third code path this PR changes.

Also applies to: 185-247

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/unit/typescript/type-script-worker-config.spec.ts` around lines 43 - 78,
The type-script worker config tests miss coverage for the native-preview
fallback path, so add a case in the typeScript worker config spec that uses a
resolveRoot fixture and sets tsgo: true to exercise
resolveDefaultPreviewPackageJsonPath(options.resolveRoot). Reuse the existing
createResolveRoot and createTypeScriptPackage helpers, or extend them to create
an `@typescript/native-preview` package fixture, then assert the resolved package
path/version for this third branch alongside the existing default typescript and
TS 7 detection cases.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@test/unit/typescript/type-script-worker-config.spec.ts`:
- Around line 43-78: The type-script worker config tests miss coverage for the
native-preview fallback path, so add a case in the typeScript worker config spec
that uses a resolveRoot fixture and sets tsgo: true to exercise
resolveDefaultPreviewPackageJsonPath(options.resolveRoot). Reuse the existing
createResolveRoot and createTypeScriptPackage helpers, or extend them to create
an `@typescript/native-preview` package fixture, then assert the resolved package
path/version for this third branch alongside the existing default typescript and
TS 7 detection cases.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f1a0cedd-8570-454e-a1b9-ddf293281243

📥 Commits

Reviewing files that changed from the base of the PR and between a780128 and 6986d23.

📒 Files selected for processing (4)
  • README.md
  • src/typescript/type-script-worker-config.ts
  • src/typescript/type-script-worker-options.ts
  • test/unit/typescript/type-script-worker-config.spec.ts

Comment thread src/typescript/type-script-worker-config.ts Outdated
Comment thread src/typescript/type-script-worker-config.ts Outdated
@chenjiahan chenjiahan merged commit c51cddc into main Jun 25, 2026
6 checks passed
@chenjiahan chenjiahan deleted the david/feat-typescript-resolve-root branch June 25, 2026 13:40
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