2

I installed the i18n-js library in a react-native project, and I got a problem with typescript.

I use the library this way:

i18n.js

import i18n from 'i18n-js';

import en from './locales/en.json';
import es from './locales/es.json';

i18n.defaultLocale = 'en';
i18n.locale = 'en';
i18n.fallbacks = true;
i18n.translations = {en, es};

export default i18n;

Auth.tsx

import i18n from '../../i18n';
...
Alert.alert(i18n.t('login.accountCreatedTitle'));

I got this annoying Typescript error:

enter image description here

How can i solve that?

FabioDev
  • 694
  • 1
  • 12
  • 27

0 Answers0