-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Description
What is the new or updated feature that you are suggesting?
I think generatePath
should extract its required parameters from the URL.
I found this "issue" when migrating from v5 to v6, thus removing @types/react-router-dom
from the dev dependencies.
The generatePath
signature from DefinitelyTyped (https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router/index.d.ts#L169) extracts the required parameters from the URL, while the official version (https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/router.ts#L103 or https://github.com/remix-run/react-router/blob/dev/packages/router/utils.ts#L478?) does not.
IIRC, in v6, it should be easier to write the "extractor" as only required parameters and the *
at the end are allowed.
Are there any reasons behind this divergence?
Why should this feature be included?
I've found that feature helpful, especially when building URLs from const
s in different components/files.