I am trying to use React 17 in a codebase that previously used version 18 (because Mobx currently has partial support for 18 and I need to debug a CPU load issue), but this seems to result in a TS types version conflict.
The TS compiler tells me that the ReactNode
type from my component is not compatible with the same type that is imported from my styled-components package, and if I run yarn why @types/react
I get:
yarn why @types/react
├─ @gemini/review-app@workspace:packages/review-app
│ └─ @types/react@npm:17.0.47 (via npm:^17)
│
...
│
└─ @types/styled-components@npm:5.1.25
└─ @types/react@npm:18.0.9 (via npm:*)
My repository is using Yarn 3 with workspaces. How can I tell yarn to resolve to React 17 types for styled-components?
I have already tried things like:
yarn set resolution @types/react@npm:18.0.9 17.0.47 --save
yarn set resolution @types/react@npm:^18 17.0.47 --save
yarn set resolution @types/react@npm:* 17.0.47 --save
...but it doesn't seem to do anything (no changes in the lock file either)