fix(react): avoid definitely typed errors with @types/react@18 #29182
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue number: resolves #29178
What is the current behavior?
DefinitelyTyped removed the
onPointerEnterCaptured
andonPointerLeaveCaptured
types for@types/react
. This caused issues when multiple versions of@types/react
are installed where an older version inlined these types, but they did not exist in newer versions.For Ionic React, we build with React 16 which did inline the types. In an Ionic React starter app we build with React 18 which does not want these types. As a result, there is a type mismatch.
Note that this type change is being reverted in React 16-17 so presumably this issue will go away in its own for those versions. However, developers are building with React 18 too, so this issue will persist for those developers.
However, React 17 should still have this problem (at least until the change is reverted), yet the build here passes. The main difference is that the
onPointer{Enter,Leave}Captured
event is no longer inlined. After talking with the Stencil team this is the current understanding of why the issue no longer reproduces.Building with React 17
Building with React 18
What is the new behavior?
Does this introduce a breaking change?
Ionic v7 expects React 17 or newer, so building with React 17 instead of React 16 is not a breaking change.
Other information
Dev build:
7.8.1-dev.11710859149.114e57ae
Verified with sample repro