Skip to content

fix: add @types/react to peerDependencies for pnpm strict mode compatibility#427

Open
afurm wants to merge 1 commit intotimolins:mainfrom
afurm:fix/add-types-react-peer-dep
Open

fix: add @types/react to peerDependencies for pnpm strict mode compatibility#427
afurm wants to merge 1 commit intotimolins:mainfrom
afurm:fix/add-types-react-peer-dep

Conversation

@afurm
Copy link
Copy Markdown

@afurm afurm commented Apr 14, 2026

Summary

Adds @types/react: * to peerDependencies to fix TypeScript resolution in pnpm strict mode.

Problem

The package's .d.ts files import from react:

import * as React from 'react';

TypeScript resolves these types through @types/react, but the package only declared react and react-dom as peer dependencies. This works in npm/yarn (flat node_modules) but fails with pnpm strict mode (hoist: false):

error TS2307: Cannot find module 'react' or its corresponding type declarations.

Solution

Add @types/react to peerDependencies. The * version constraint matches any version that the consumer already has.

Testing

Verified by adding to a project with pnpm strict mode enabled.

Fixes #426

…ibility

Fixes timolins#426

Adds @types/react to peerDependencies since the package's .d.ts files
import from react, and TypeScript resolves these types through @types/react.
Without it, pnpm strict mode (hoist: false) fails with:
  error TS2307: Cannot find module 'react'
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 14, 2026

@afurm is attempting to deploy a commit to the timo's Team Team on Vercel.

A member of the Team first needs to authorize it.

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.

react-hot-toast fails with pnpm strict mode — missing peerDependency on @types/react

1 participant