Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Adjust locale switcher example to provide more type safety #1256

Merged
merged 1 commit into from
Aug 14, 2024

Conversation

Copy link

vercel bot commented Aug 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-intl-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 14, 2024 11:58am
next-intl-example-app-router ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 14, 2024 11:58am
next-intl-example-app-router-without-i18n-routing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 14, 2024 11:58am

// @ts-expect-error -- TypeScript will validate that only known `params`
// are used in combination with a given `pathname`. Since the two will
// always match for the current route, we can skip runtime checks.
params
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By moving the directive here, we keep the validation that an object can be received by router.replace. In case of shared pathnames, this will show an error.

@amannn amannn merged commit aecb75c into main Aug 14, 2024
6 checks passed
@amannn amannn deleted the docs/change-locale-sample branch August 14, 2024 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant