react-router icon indicating copy to clipboard operation
react-router copied to clipboard

Narrow types for `hash`, `pathname` and `search`

Open lensbart opened this issue 1 year ago • 6 comments

Fixes https://github.com/remix-run/react-router/issues/11254

In order to be able to run yarn build, I had to add some type casts. Not sure if this is the right tradeoff. My first approach was to update interface Path (which Location extends from), but this caused many type errors which eventually lead to having to typecast window.location etc. anyway. My second and current approach was to cast types at the outermost perimeter only.

The type casts are committed separately.

lensbart avatar Feb 16 '24 18:02 lensbart

🦋 Changeset detected

Latest commit: 28a079dd928274f3571dca4ddfe11937ad2fa47a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
react-router Patch
react-router-dom Patch
react-router-dom-v5-compat Patch
react-router-native Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Feb 16 '24 18:02 changeset-bot[bot]

Hi @lensbart,

Welcome, and thank you for contributing to React Router!

Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once.

You may review the CLA and sign it by adding your name to contributors.yml.

Once the CLA is signed, the CLA Signed label will be added to the pull request.

If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at [email protected].

Thanks!

- The Remix team

remix-cla-bot[bot] avatar Feb 16 '24 18:02 remix-cla-bot[bot]

Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳

remix-cla-bot[bot] avatar Feb 16 '24 18:02 remix-cla-bot[bot]

The only other thing this needs is some tests to ensure we don't break this in the future and it continues to function as expected through future versions of TS.

timdorr avatar Feb 16 '24 21:02 timdorr

@timdorr consider it done!

lensbart avatar Feb 16 '24 23:02 lensbart

@brophdawg11 is this something you would still be interested in merging? Then I’ll resolve the conflicts. Thanks!

lensbart avatar May 28 '24 14:05 lensbart