Skip to content
New issue

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

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

Already on GitHub? # to your account

Incorrect types in the global $i18n object #3329

Open
ekh-anadeainc opened this issue Jan 27, 2025 · 4 comments
Open

Incorrect types in the global $i18n object #3329

ekh-anadeainc opened this issue Jan 27, 2025 · 4 comments
Assignees
Labels
🔨 p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage typescript workaround

Comments

@ekh-anadeainc
Copy link

ekh-anadeainc commented Jan 27, 2025

Environment

  "devDependencies": {
    "@nuxtjs/i18n": "^9.1.3",
    "nuxt": "^3.15.3"
  }

Reproduction

https://stackblitz.com/edit/bobbiegoede-nuxt-i18n-starter-ibsjbrfq?file=plugins%2Flanguage.ts

Describe the bug

Incorrect types in the global $i18n object. (Probably because of these changes: https://github.com/nuxt-modules/i18n/pull/3324/files)
The actual type of the locales variable is ref, not LocaleObject.

@BobbieGoede
Copy link
Collaborator

I tried to make these properties more consistent (these should be computed/ref) with #3324, is there a specific reason you're using nuxtApp.vueApp.config.globalProperties.$i18n instead of useNuxtApp().$i18n in the plugin?

Kind of related #2157

@ekh-anadeainc
Copy link
Author

I used nuxtApp.vueApp.config.globalProperties.$i18n because that's the plugin context, but it looks like useNuxtApp().$i18n works as expected. In that case, I'll switch to useNuxtApp, thanks.

@ekh-anadeainc
Copy link
Author

Should I close the issue or are you going to investigate the wrong typing in nuxtApp.vueApp.config.globalProperties.$i18n?

@BobbieGoede
Copy link
Collaborator

Let's keep this open, I'll look into fixing the types 🙏

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
🔨 p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage typescript workaround
Projects
None yet
Development

No branches or pull requests

2 participants