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

TypeScript error triggered between i18next-chained-backend and i18next-http-backend #22

Closed
jdeniau opened this issue Jul 29, 2021 · 4 comments

Comments

@jdeniau
Copy link

jdeniau commented Jul 29, 2021

🐛 Bug Report

There is a conflict in the .d.ts files between i18next-chained-backend and i18next-http-backend

To Reproduce

i18n config

import i18n from 'i18next';
import ChainedBackend from 'i18next-chained-backend';
import HttpApi from 'i18next-http-backend';

const httpBackend = new HttpApi(null, {
  loadPath: '/somewhere'
});

i18n
  .use(ChainedBackend)
  .init({
    backend: {
      backends: [
        httpBackend,
       // fallback backend
      ],
    },
  });

Current behavior

node_modules/i18next-http-backend/index.d.ts:122:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'backend' must be of type 'BackendOptions | undefined', but here has type 'BackendOptions | undefined'.

122     backend?: BackendOptions;
        ~~~~~~~

  node_modules/i18next-chained-backend/index.d.ts:42:5
    42     backend?: I18NextChainedBackend.BackendOptions;
           ~~~~~~~
    'backend' was also declared here.

Expected behavior

No error

Possible temporary fix

Setting "skipLibCheck": true hide the issue

Your Environment

  • typescript: 4.3.5
  • i18next-chained-backend : 3.0.2
  • i18next-http-backend: 1.3.0
@adrai
Copy link
Member

adrai commented Jul 29, 2021

did you set the skipLibCheck to true? https://github.com/i18next/i18next-chained-backend#typescript

@jdeniau
Copy link
Author

jdeniau commented Jul 30, 2021

@adrai Oh sorry I didn't see that this is in the readme file 🤦

As a matter of fact I did post the solution as a "temporary fix" in my issue.

It is something that is fixable that you did not managed to fix or is it by design ?

@adrai
Copy link
Member

adrai commented Jul 30, 2021

@pedrodurek maybe knows the detail?

@pedrodurek
Copy link
Member

It's by design, that's the only way to automatically infer PluginOptions which happens to have conflicts with other plugins. skipLibCheck: true is also recommended to reduce compilation time.

@adrai adrai closed this as completed Jul 30, 2021
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

3 participants