remix-run / history

Manage session history with JavaScript
MIT License
8.29k stars 960 forks source link

Support numeric `to` #892

Closed chaance closed 2 years ago

chaance commented 3 years ago

Resolves the same issue as https://github.com/remix-run/history/pull/795, but quite a bit seems to have changed since that PR was opened. We need to tweak some of our type checking logic if we're going to parse numbers as potential paths.

chaance commented 2 years ago

Thinking about this more, I don't think we should support this. Yes it's convenient but String(to) is not a big workaround, and if we say that number is an acceptable type we'd probably want to do NaN checks, and honestly I think that's complexity we can leave to the consumer if it's important to them.