`@headlessui/react` fails with pnpm strict mode — missing peerDependency on `@types/react`
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- react, typescript
- Domain
- frontend
Research direction
Start by checking the @headlessui/react package.json and its peerDependencies declaration. Add the missing @types/react peer dependency, then verify the package resolves the imported React types with pnpm hoisting disabled; done means the reported TypeScript error no longer occurs.
Written by the indexing model from the issue text.
Description
@headlessui/react@2.2.9 ships .d.ts files that import from react:
import * as React from 'react';
TypeScript resolves these types through @types/react, but the package only declares react and react-dom as peer dependencies — not @types/react. This works in flat node_modules layouts (npm, yarn) because @types/react is hoisted from the consuming project. When pnpm hoisting is disabled (hoist: false), TypeScript cannot find the React types and fails with:
error TS2307: Cannot find module 'react' or its corresponding type declarations.
Workaround:
packageExtensions:
"@headlessui/react@2":
peerDependencies:
"@types/react": "*"
Suggested fix: Add @types/react to peerDependencies in @headlessui/react's package.json.
- Dominant language
- TypeScript
- Stars
- 28.7k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from tailwindlabs/headlessui
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
tailwindlabs/headlessui#3888 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
tailwindlabs/headlessui#3838 · 1 comment ·
-
Dialog: interrupted enter transition deadlocks useTransition (open flip during duration-100 enter) Open
Difficulty 3/5 1-2 days Newbie friendliness 68/100
tailwindlabs/headlessui#3892 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 76/100
tailwindlabs/headlessui#3890 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
tailwindlabs/headlessui#3886 · 1 comment ·
All issues in tailwindlabs/headlessui
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100