Closed adriangodong closed 3 years ago
Can you try with v6.1.2 ?
Can you try with v6.1.2 ?
Yes, it works! Thank you for the quick fix.
Hi @adrai - I updated to 6.1.2 but I'm still getting an error related to the commit above. I'm running this in an Angular application and seeing the error while compiling.
i18next-browser-languagedetector version: 6.1.2 Typescript: 4.2.4
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'.
detect(detectionOrder?: DetectorOptions['order']): string | string[] | undefined;
Any help is appreciated, thanks!
@wrobe0709 please make sure you really updated all i18next dependencies... if the issue still persists, create a reproducible example.
@adrai - thanks for the quick response. I needed to update the i18Next package as well. Updating that to the latest got things working. Thanks again!
🐛 Bug Report
The type definition for
CustomDetector.lookup
islookup(options: DetectorOptions): string | undefined;
. In index.js and navigator.js, the return type can be a string array. Please update the type definition tolookup(options: DetectorOptions): string[] | string | undefined;
To Reproduce
Create a new custom detector and return an array (of string) in TypeScript, for example:
Build error with
Type 'string[]' is not assignable to type 'string'.ts(2322)
.Expected behavior
No build error.
Your Environment