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

Type 'ChainedBackendOptions' has no properties in common with type 'InitOptions<unknown>' #29

Closed
laclance opened this issue Dec 21, 2022 · 4 comments

Comments

@laclance
Copy link

After updating packages I cannot get rid of typescipt errors. I copied the example from the docs.
If I remove the <ChainedBackendOptions> then it says 'backends' does not exist in type 'LocizeBackendOptions'.

import i18next from 'i18next';
import { initReactI18next } from 'react-i18next';
import ChainedBackend, { ChainedBackendOptions } from 'i18next-chained-backend';
import LocizeBackend from 'i18next-locize-backend';
import HTTPBackendLocal from 'i18next-http-backend';
import pos from 'pos.json';

export const defaultNS = 'pos';
export const resources = {
  en: {
    pos
  }
} as const;

i18next
  .use(initReactI18next)
  .use(ChainedBackend)
  .init(<ChainedBackendOptions>{
    backend: {
      backends: [
        LocizeBackend, // primary
        HTTPBackendLocal // fallback
      ],
      backendOptions: [
        {
          projectId: 'myLocizeProjectId'
        },
        {
          loadPath: '/locales/{{lng}}/{{ns}}.json' // http api load path for my own fallback
        }
      ]
    },
    fallbackLng: 'en',
    fallbackNS: 'pos',
    defaultNS: 'pos',
    ns: ['pos'],
    interpolation: {
      escapeValue: false
    }
  });

export default i18next;
  • runtime version: i.e. node v14.20, chrome
  • os: windows
    "i18next": "^22.4.6",
    "i18next-chained-backend": "^4.2.0",
    "i18next-http-backend": "^2.1.1",
    "i18next-locize-backend": "^6.0.0",
@adrai
Copy link
Member

adrai commented Dec 21, 2022

Make sure you've updated all i18next dependencies.
If the problem still persists, create a minimal reproducible repository or similar please.

@adrai
Copy link
Member

adrai commented Dec 21, 2022

make sure you've installed v6.1.1 of i18next-locize-backend

@adrai
Copy link
Member

adrai commented Dec 21, 2022

@adrai adrai closed this as completed Dec 21, 2022
@laclance
Copy link
Author

thank you, yarn did not update to v6.1.1

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

No branches or pull requests

2 participants