Replies: 3 comments
-
We did include TypeScript in the 19 upgrade guide: https://react.dev/blog/2024/04/25/react-19-upgrade-guide#typescript-changes |
Beta Was this translation helpful? Give feedback.
-
totally agree with you. Since TypeScript has become a staple in the React ecosystem—often the default choice for many projects—any breaking changes in type packages can significantly impact developers’ upgrade paths. Including clear documentation of breaking changes in type definitions within migration guides would: Help developers anticipate and prepare for necessary code changes. Reduce upgrade frustration and time spent debugging type errors. Encourage smoother transitions between versions, especially for major releases. While maintaining types directly in the main repo would be ideal for cohesion and consistency, it’s definitely not a strict requirement. At the very least, having a dedicated, easily accessible changelog or migration section specifically for type-related changes would be a huge benefit. |
Beta Was this translation helpful? Give feedback.
-
Recent breaking changes in @types/react and @types/react-dom are mostly related to updates for React 18 and its concurrent features. Some key points: Type updates for useTransition and useDeferredValue: These hooks now have stricter type definitions to align with the latest React API. Changes to event types: Some synthetic event types have been refined, which may cause TypeScript errors if your code relied on older, more permissive types. Removal/renaming of deprecated types: Types that were previously kept for backward compatibility may now be removed or moved to separate type definitions. ReactNode adjustments: The ReactNode type definition has been updated, potentially affecting components returning certain JSX patterns. How to fix issues: Ensure you’re on the matching React and @types/react versions. Update your code to match the new, stricter type definitions. If needed, add temporary type assertions to unblock builds, but plan to refactor. For a smooth upgrade, check the DefinitelyTyped GitHub changelog for detailed migration notes. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Considering there's a considerable presence of Typescript usage, perhaps even majority, in the react-world, I think it's time that breaking changes for type packages are part of migration guides. At least they should be well documented somewhere easily accessible. Ideally, types should be maintained in this repo, but not a necessity.
Would you agree?
Beta Was this translation helpful? Give feedback.
All reactions