Type 'Promise<TFunction>' is missing the following properties from type 'i18n'
See original GitHub issueDescribe the bug Hello,
I’m trying to migrate from lower version to latest one. I updated i18next, react-i18next and solved many issues (like replacing withNamespaces to withTranslation etc.) but I cannot handle one error. I got error TS2740: Type 'Promise<TFunction>' is missing the following properties from type 'i18n': init, loadResources, use, modules, and 26 more.
As you can see I’m using it with Typescript.
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
const i18n = i18n
.use(initReactI18next)
.init({
fallbackLng: 'en',
debug: true,
});
export default i18n;
The error appears on my tests cases but also if I want to use it with I18nextProvider
import {I18nextProvider} from 'react-i18next';
import i18n from '@/i18n/i18n';
<I18nextProvider i18n={i18n}>
</I18nextProvider>
Occurs in react-i18next version “i18next”: “^15.0.9”, “react-i18next”: “^10.6.2”,
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
React ts Type 'Promise<X>' is missing the following properties ...
fetchAllProducts(products ) is a function that returns promise, not an array. To fix it you could write something like:
Read more >React: Type is missing the following properties from type
js error "Type is missing the following properties from type" occurs when we don't pass any props to a component, or don't pass...
Read more >TypeScript errors and how to fix them
error TS2740: Type ' TextLine ' is missing the following properties from type ' Position ': line, character, isBefore, isBeforeOrEqual, and 6 more....
Read more >ECMAScript® 2023 Language Specification - TC39
Properties are containers that hold other objects, primitive values, or functions. A primitive value is a member of one of the following built-in...
Read more >API Reference | Ajv JSON schema validator
In typescript returned validation function can be a type guard if you pass type ... missing schema can't be loaded ( loadSchema returns...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
this should work:
or await the promise (this will only work with top level await support):
If you are mocking and not fulfilling the static type, you’ll need to cast to
any
.