Skip to content

fix(react): support strict pnpm type resolution#3866

Open
raashish1601 wants to merge 1 commit intotailwindlabs:mainfrom
raashish1601:contributor-07/headlessui-3865
Open

fix(react): support strict pnpm type resolution#3866
raashish1601 wants to merge 1 commit intotailwindlabs:mainfrom
raashish1601:contributor-07/headlessui-3865

Conversation

@raashish1601
Copy link
Copy Markdown

Fixes #3865.

Summary

  • declare @types/react as an optional peer dependency for @headlessui/react so strict pnpm installs link the React types where the package declarations need them
  • make useFloatingReference() export the UseFloatingReturn['refs']['setReference'] type explicitly so the generated declarations stop leaking a direct @floating-ui/react-dom import from a transitive dependency

Validation

  • reproduced the published-package failure in a fresh strict pnpm consumer (hoist=false) where @headlessui/react@2.2.9 fails tsc --noEmit
  • built @headlessui/react locally under Git Bash and confirmed packages/@headlessui-react/dist/internal/floating.d.ts no longer imports @floating-ui/react-dom
  • reran the same strict pnpm consumer against the local package and confirmed corepack pnpm exec tsc --noEmit passes

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 28, 2026

@raashish1601 is attempting to deploy a commit to the Tailwind Labs Team on Vercel.

A member of the Team first needs to authorize it.

mahdirajaee

This comment was marked as spam.

"clean": "rimraf ./dist"
},
"peerDependencies": {
"@types/react": "*",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It would probably make sense to synchronize this with the react dep itself, i.e.,

"@types/react": "^18 || ^19 || ^19",

@baraknaveh
Copy link
Copy Markdown

Thanks for the PR!

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.

@headlessui/react fails with pnpm strict mode — missing peerDependency on @types/react

3 participants