Chore: Add react-router-dom typing #2869
Merged
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.
What kind of change does this PR introduce?
@Saeris @christianalfoni
This PR adds
@types/react-router-domtoapprepo in order to get correctreact-router-domcomponents typing.Which is necessary to convert current
react-router-domcomponents usage injsfiles totsfiles, such as:app/src/app/pages/Dashboard/Content/routes/PathedSandboxes/Navigation/elements.jsWhat is the current behavior?
Currently there is no typing for all
react-router-domcomponents, so there is no type checking forpropsassigned to them.Also
withRouter()hoc, can take any components no matter if it expectsRouteComponentPropsor not.What is the new behavior?
This PR will introduce
react-router-domtype checking for its usage.And
withRouter()hoc would expect component explicitly expectsRouteComponentProps.PS: I am not aware of why some of the component is wrapped in
withRouter()but without using anyRouteComponentProps, might can be simply removed usage ofwithRouter(), instead of current fix by introducing newpropsto them.What steps did you take to test this? This is required before we can merge, make sure to test the flow you've updated.
Checklist