Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Narrow types for hash, pathname and search #11282

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from

Conversation

lensbart
Copy link

@lensbart lensbart commented Feb 16, 2024

Fixes #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.

Copy link

changeset-bot bot commented Feb 16, 2024

🦋 Changeset detected

Latest commit: 28a079d

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

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Feb 16, 2024

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 hello@remix.run.

Thanks!

- The Remix team

@lensbart lensbart changed the base branch from main to dev February 16, 2024 18:40
@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Feb 16, 2024

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

@lensbart lensbart marked this pull request as ready for review February 16, 2024 20:04
@timdorr
Copy link
Member

timdorr commented Feb 16, 2024

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.

@lensbart
Copy link
Author

@timdorr consider it done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Types]: Narrow types of hash and search returned by useLocation
2 participants