i18next / i18next-browser-languageDetector

language detector used in browser environment for i18next
MIT License
873 stars 90 forks source link

Property 'detect' in type 'I18nextBrowserLanguageDetector' is not assignable to the same property in base type 'LanguageDetectorModule'. #257

Closed mbezgin closed 2 years ago

mbezgin commented 2 years ago

🐛 Bug Report

Have such error

node_modules/i18next-browser-languagedetector/index.d.ts:82:3 - error TS2416: Property 'detect' in type 'I18nextBrowserLanguageDetector' is not assignable to the same property in base type 'LanguageDetectorModule'.
  Type '(detectionOrder?: string[]) => string | string[]' is not assignable to type '() => string'.
    Type 'string | string[]' is not assignable to type 'string'.
      Type 'string[]' is not assignable to type 'string'.

82   detect(detectionOrder?: DetectorOptions['order']): string | string[] | undefined;

To Reproduce

initialization

i18n
  .use(LanguageDetector)
  .use(initReactI18next)
  .init({
    fallbackLng: 'en',
    debug: true,
    interpolation: {
      escapeValue: false,
    },
  });
"dependencies": {
    "i18next": "21.6.14",
    "i18next-browser-languagedetector": "6.1.4",
    "react-i18next": "11.16.2"
  }

Your Environment

Everything is ok with "i18next-browser-languagedetector": "6.1.1"

adrai commented 2 years ago

I'm not able to reproduce this, can you create a reproducible example? Maybe on codesandbox or similar?

Seems to work here: https://codesandbox.io/s/recursing-rubin-9o8yve?file=/src/index.ts

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.