Localized pathname type error when reached a certain number of objects #726
Labels
bug
Something isn't working
contributions welcome
Good for people looking to contribute
has-workaround
upstream-issue
This issue is caused by an upstream dependency (e.g. Next.js)
Description
I'm implementing localized pathname approach with the doc when I add the language switcher that change the locale of the current page, the
router.replace
method would not accept thepathname
variables that was returned byusePathname()
. Further investigation shows it stops erroring once I reduce the number of routes in my localized pathname object, might be a typescript compiling issue 🤣 Anyway, please take a look and at the recreation repo below on the branch "next-intl-issue". If you add another route thepathname
innavigation.ts
typescript will error out inSwitcher.tsx
. In this repo the threshold is 26, but in my other project it's 24, that website has a dynamic route in the pathname.Mandatory reproduction URL (CodeSandbox or GitHub repository)
https://github.com/m4rvelous252/next-demo/tree/next-intl-issue
Reproduction description
Steps to reproduce:
pathnames
innavigation.ts
Switcher.tsx
Expected behaviour
Would be nice if typescript behave correctly here
The text was updated successfully, but these errors were encountered: