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

@types/react-router 4.0.31 errors #28894

Closed
rlee0525 opened this Issue Sep 14, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@rlee0525
Copy link

rlee0525 commented Sep 14, 2018

I tried using the most recent version of @types/react-router (v 4.0.31) and had problems.
It's now expecting strings for history, match and location but I don't think they've changed in react-router.

history?: string | undefined; match?: string | undefined; location?: string | undefined;

Authors:
Sergey Buturlakin
Yuichi Murata
Václav Ostrožlík
Nathan Brown
Alex Wendland
Kostya Esmukov
John Reilly
Karol Janyst
Dovydas Navickas
Tanguy Krotoff
Huy Nguyen
Jérémy Fauvel
Daniel Roth
Egor Shulga
Youen Toupin
Rahul Raina
Maksim Sharipov
Duong Tran

@johnnyreilly

This comment has been minimized.

Copy link
Member

johnnyreilly commented Sep 15, 2018

It's now expecting strings for history, match and location but I don't think they've changed in react-router.

That's what react router produces; just strings.

The motivation behind the PR was a colleague spending an afternoon wondering why when he said a parameter was a number in his code that it wasn't actually a number at runtime. He could have been saved that with a compile time error. Which is what he would now get 😄

If you debug Recursive.js here: https://reacttraining.com/react-router/web/example/recursive-paths

You can see an illustration of this. At first glance you'd think the router was returning number for the id; debug it and you realise it isn't (hence the use of == rather than ===)

The docs could be clearer TBH. In the end parameter matching works based upon a RegEx that produces strings.

Related PR: #28868

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