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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type instantiation is excessively deep and possibly infinite. #1715

Closed
pavanjoshi914 opened this issue Feb 1, 2024 · 5 comments
Closed

Type instantiation is excessively deep and possibly infinite. #1715

pavanjoshi914 opened this issue Feb 1, 2024 · 5 comments

Comments

@pavanjoshi914
Copy link

馃挜 Regression Report

i have chrome extension written in react with react-i18next used for translations when for the resuable component i think 4 level nesting is throwing error

Type instantiation is excessively deep and possibly infinite.
PasswordForm component: 
 const { t } = useTranslation("translation", {
    keyPrefix: i18nKeyPrefix,
  });


<TextField
          autoFocus={autoFocus}
          id="password"
          label={t("choose_password.label")}
 		 .....  
        />

reusable component PasswordForm called through some other component

<PasswordForm
              i18nKeyPrefix="welcome.set_password"
              formData={formData}
              setFormData={setFormData}
            />

so the final translation is welcome.set_password.choose_password.label

config::

import { defaultNS, resources } from "./i18n/i18nConfig";

declare module "i18next" {
  interface CustomTypeOptions {
    defaultNS: typeof defaultNS;
    resources: (typeof resources)["en"];
  }
}

Last working version

Worked up to version: v12

Stopped working in version: v13 and onwards

To Reproduce

// Paste your code here

Expected behavior

A clear and concise description of what you expected to happen.

// Paste the results here

Your Environment

  • runtime version: i.e. node v14, deno, browser xy
  • i18next version: 23.8.2
  • react-i18next version: 14.0.1
  • os: Mac, Windows, Linux
  • any other relevant information
@adrai
Copy link
Member

adrai commented Feb 1, 2024

Please provide a minimal reproducible example... not just code snippets.

@pavanjoshi914
Copy link
Author

pavanjoshi914 commented Feb 1, 2024

what is the different between declare module "react-i18next" and declare module "i18next" i see error resolved when i use react-i18next

@adrai
Copy link
Member

adrai commented Feb 1, 2024

declare module "react-i18next" is for the old version...
You probably don't see errors with that because there is also no type safety

@jbarop
Copy link

jbarop commented Mar 15, 2024

I just had a very strange case.

I had the i18next.d.ts in the /src/@types/ directory and was struggling with the TS2589 error. After I moved the file to src/ it suddenly worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants