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

LocaleObject type is no longer exported in v9 #3201

Open
maxdzin opened this issue Nov 4, 2024 · 3 comments · May be fixed by #3212
Open

LocaleObject type is no longer exported in v9 #3201

maxdzin opened this issue Nov 4, 2024 · 3 comments · May be fixed by #3212
Labels
🔨 p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage typescript

Comments

@maxdzin
Copy link

maxdzin commented Nov 4, 2024

Environment

Nuxt project info: 11:04:15 PM



Reproduction

https://stackblitz.com/edit/github-z4bplq?file=types%2Flocale.ts
Go to types/locale.ts file and check the LocaleObject import...
or launch pnpm typecheck in terminal to see that error.

Describe the bug

LocaleObject is no longer exported from the @nuxtjs/i18n module (v9).

Additional context

No response

Logs

error TS2614: Module '"@nuxtjs/i18n"' has no exported member 'LocaleObject'. Did you mean to use 'import LocaleObject from "@nuxtjs/i18n"' instead?

2 import type { LocaleObject } from '@nuxtjs/i18n'

@Xenossolitarius
Copy link

Exported type for locales in general is {}[]. And in schema file it looks like the generation failed

@BobbieGoede BobbieGoede added typescript 🔨 p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage and removed pending triage labels Nov 5, 2024
@BobbieGoede
Copy link
Collaborator

Hmm I guess we should be exporting this if we originally did this, I can see the value of having it available for end users though I don't think this was documented.

Not sure if it should be the generated narrowed type (locale code string literals) or a more permissive version, or both?

@Xenossolitarius
I'm not sure what you mean, can you provide more information?

@Xenossolitarius
Copy link

Xenossolitarius commented Nov 5, 2024

@BobbieGoede Sorry don't have the exact snippets but the types remained actually the same. My bad. But the template looks like this:

.nuxt > types > schema.d.ts

   i18n: {
      baseUrl: string,

      defaultLocale: string,

      defaultDirection: string,

      strategy: string,

      lazy: boolean,

      rootRedirect: any,

      routesNameSeparator: string,

      defaultLocaleRouteNameSuffix: string,

      skipSettingLocaleOnNavigate: boolean,

      differentDomains: boolean,

      trailingSlash: boolean,
 
      configLocales: Array<{

      }>,

      locales: {
         ro: {
            domain: any,
         },

         en: {
            domain: any,
         },

         hr: {
            domain: any,
         },
      },

where configLocales seems like the generation of types missfired? Maybe it just looks like that bcs of templating

@userquin userquin linked a pull request Nov 9, 2024 that will close this issue
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage typescript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants