fix(xychart): strip legacy react events from exhaustive prop lists in type declarations #1841
+30
−7
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.
🐛 Bug Fix
The event names
onPointerEnterCapture
andonPointerLeaveCapture
are erroneously included in the types for React 16 and 17 - these have never been valid event names, but the decision has been taken to leave them in place based on the definitely-typed backporting policy. However, these event names have been removed from the types for React 18.In a few places in xycharts, properties are removed from components with DOM element props
using the
Omit
utility type. When the declarations are generated, theseOmit
s are transformed intoPick
s with the inverted set of keys. This results in all known properties for these components (includingonPointerEnterCapture
andonPointerLeaveCapture
) being included. This causes compilation errors for consumers of this package that use React 18.This commit proposes a heavily targeted fix by including the removed event names in the string unions passed to
Omit
. This is somewhat distasteful, because it only resolves the issue for existing occurrences - any new places in the codebase with this pattern will need to be specifically handled.Possible future improvements