Allow href() to accept number params #13447
michaelboyles
started this conversation in
Proposals
Replies: 1 comment
-
I think it's as simple as changing this line to e.g. type ArgumentValue = string | number;
type Args = { [K in keyof Params]: ToArgs<Record<keyof Params[K], ArgumentValue>> }; |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Before RR v7, I was using safe-routes (previously called remix-routes).
Their
$path
is mostly compatible with RRs newhref
, so in some circumstances it's find-and-replace-able.One of the big differences is that
$path
accepts numbers, buthref
only accepts strings. It's especially annoying if you're doing something like thisI looked at the implementation of
href
and it doesn't actually require the arg to be a string. This is purely a type checker issue. For example, it works fine just with a castI suggest that we widen the allowed types to
string | number
(and maybe| boolean
?). It will help with migration from safe-routes, and makehref
a little nicer to useRelated to #12697
Beta Was this translation helpful? Give feedback.
All reactions