Skip to content

fix: restore @types/react hoisting for pnpm 10#2057

Merged
nick-inkeep merged 1 commit intomainfrom
fix/restore-types-public-hoist-pattern
Feb 17, 2026
Merged

fix: restore @types/react hoisting for pnpm 10#2057
nick-inkeep merged 1 commit intomainfrom
fix/restore-types-public-hoist-pattern

Conversation

@nick-inkeep
Copy link
Collaborator

Summary

  • Adds publicHoistPattern to pnpm-workspace.yaml to hoist @types/react and @types/react-dom to the monorepo root
  • Fixes TypeScript resolution escape that causes dual-@types/react compilation errors in agents-docs

Problem

pnpm 10 changed publicHoistPattern default from ['*types*', '*eslint*'] to [] (pnpm v10 release notes). This removed the @types/react symlink at the monorepo root that previously acted as a TypeScript resolution firewall.

agents-docs has cross-boundary imports from agents-api/ (OpenAPI snapshot, model utilities). When TypeScript resolves @types/react from those external file locations, it walks up the directory tree:

agents-api/node_modules/          → no @types/react
agents/node_modules/@types/        → doesn't exist (pnpm 10 removed hoisting)
../node_modules/@types/react       → stale v18.2.47 if parent has one

This creates two incompatible React type instances (v18 + v19) in the same compilation = type errors.

Fix

Add targeted publicHoistPattern in pnpm-workspace.yaml (the canonical pnpm 10 location for this setting):

publicHoistPattern:
  - "@types/react"
  - "@types/react-dom"

The pattern is intentionally narrow (not @types/*) because hoisting @types/bun pollutes the global fetch type with Bun-specific preconnect extension, breaking ai-sdk-provider typecheck.

After applying

Contributors need to run pnpm install after pulling this change to regenerate the hoisting symlinks. No lockfile changes.

Test plan

  • pnpm --filter agents-docs typecheck passes
  • pnpm typecheck (full monorepo, 15/15 tasks) passes
  • pnpm format:check passes
  • Verified node_modules/@types/react exists at monorepo root after install
  • Verified @types/bun is NOT hoisted (prevents fetch type pollution)
  • No pnpm-lock.yaml changes

🤖 Generated with Claude Code

…scape

pnpm 10 changed `publicHoistPattern` default from `['*types*', '*eslint*']`
to `[]`, removing the firewall that prevented TypeScript module resolution
from escaping the monorepo boundary.

When agents-docs imports files from agents-api (cross-boundary imports for
OpenAPI spec and model utilities), TypeScript resolves @types/react from
those external locations by walking up ancestor directories. Without
@types/react hoisted at the monorepo root, the walk escapes past
agents/node_modules/ into any parent directory that might have a stale
node_modules with a different @types/react version — causing dual-type
compilation errors.

Adding targeted publicHoistPattern for @types/react and @types/react-dom
restores the monorepo-root firewall. The pattern is intentionally narrow
(not @types/*) to avoid hoisting @types/bun which pollutes the global
fetch type with Bun-specific extensions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agents-api Ready Ready Preview, Comment Feb 17, 2026 1:13pm
agents-docs Ready Ready Preview, Comment Feb 17, 2026 1:13pm
agents-manage-ui Ready Ready Preview, Comment Feb 17, 2026 1:13pm

Request Review

@changeset-bot
Copy link

changeset-bot bot commented Feb 17, 2026

⚠️ No Changeset found

Latest commit: cf1a82d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

@claude claude bot left a comment

Choose a reason for hiding this comment

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

PR Review Summary

(0) Total Issues | Risk: Low

This is a clean, well-targeted infrastructure fix with no actionable concerns.

🔴❗ Critical (0) ❗🔴

None.

🟠⚠️ Major (0) 🟠⚠️

None.

🟡 Minor (0) 🟡

None.

💭 Consider (0) 💭

None.


✅ APPROVE

Summary: This is a well-reasoned, minimal fix for a real TypeScript resolution issue caused by pnpm 10's breaking change to publicHoistPattern defaults. The narrow scope (only @types/react and @types/react-dom, not @types/*) is deliberate and correct — hoisting @types/bun would pollute global types and break ai-sdk-provider. The PR description is thorough, the test plan is comprehensive, and the change is configuration-only with no lockfile impact. Ship it! 🚀

Discarded (4)
Location Issue Reason Discarded
pnpm-workspace.yaml Narrow publicHoistPattern is well-reasoned Positive validation, not an issue
pnpm-workspace.yaml No lockfile changes as expected Positive validation, not an issue
.github/composite-actions/install/action.yml Cached node_modules may have stale symlink layout Speculative, reviewer notes "likely benign" and pnpm should auto-detect
pnpm-workspace.yaml Configuration placement is correct for pnpm 10 Positive validation, not an issue
Reviewers (1)
Reviewer Returned Main Findings Consider While You're Here Inline Comments Pending Recs Discarded
pr-review-devops 4 0 0 0 0 0 4
Total 4 0 0 0 0 0 4

@github-actions github-actions bot deleted a comment from claude bot Feb 17, 2026
@nick-inkeep nick-inkeep merged commit e440010 into main Feb 17, 2026
11 checks passed
@nick-inkeep nick-inkeep deleted the fix/restore-types-public-hoist-pattern branch February 17, 2026 13:21
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.

1 participant

Comments