[Feature Request] Move non-optional arguments last in functions
Kingdutch opened this issue · 1 comments
Kingdutch commented
I found at least one example where a non-optional parameter comes before an optional named parameter. This results in making the optional named parameter non-optional or requiring another unit argument.
I would propose to change this to
let isRouteActive = (~exact: bool=false, {pathname}: RelayRouter.Bindings.History.location): bool => {
This enables the following to work without errors:
Route.isRouteActive(location)
Route.isRouteActive(~exact=false, location)
location->Route.isRouteActive
location->Route.isRouteActive(~exact=false)
We can use this issue to find other places where ergonomics can be improved.
zth commented
Yes, this sounds great, good catch!