Replies: 1 comment 1 reply
-
is it ok to use getPathname and don't include the locale prop?
|
Beta Was this translation helpful? Give feedback.
1 reply
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey,
I was doing a big abstract function to construct a pathname based on some database value (that I will then use everywhere, on links/getPathnames function for metada stuff etc) following this: https://next-intl.dev/docs/routing/navigation#link-composition
I saw that the typing signature of the getPathname function href prop was different than the Link component href one. It made my TS yell at me when I wanted to use my function to populate a getPathname href.
I guess it's because of how typing of a jsx props works, and it got me wondering if I was not doing something wrong here? My two sense would be to update my generic function to this return type:
Parameters<typeof getPathname>[0]["href"]
instead ofComponentProps<typeof Link>["href"]
Since its more restrictive.
What do you guys think?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions