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

feat: locales generated type narrowing #2722

Merged

Conversation

BobbieGoede
Copy link
Collaborator

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR is built on top of #2714, I have it marked WIP/draft until that PR has been merged/reviewed.

Resolves #2628

Now that vue-i18n-routing has been fully integrated we have more control over the types, this PR changes the augmented vue-i18n types based on the generated options of a project. This way the locales type will be correctly inferred based on whether it was configured as string[] or LocaleObject[] in the configuration file (or that of extended layers).

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@kazupon kazupon marked this pull request as ready for review January 22, 2024 03:32
Copy link
Collaborator

@kazupon kazupon left a comment

Choose a reason for hiding this comment

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

Good job!
Thanks!
LGTM!

@kazupon kazupon changed the title [WIP] feat: locales generated type narrowing feat: locales generated type narrowing Jan 22, 2024
@kazupon kazupon merged commit 489f13d into nuxt-modules:main Jan 22, 2024
7 checks passed
DarthGigi pushed a commit to DarthGigi/i18n that referenced this pull request Apr 16, 2024
* refactor: options passing

* feat: narrow `locales` based on generated options

* chore: remove type assertions in playground
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nuxt i18n config type issue
2 participants