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

Type errors when upgrading to 23.7.6 while using react-i18next #2065

Closed
frontendphil opened this issue Nov 15, 2023 · 4 comments
Closed

Type errors when upgrading to 23.7.6 while using react-i18next #2065

frontendphil opened this issue Nov 15, 2023 · 4 comments
Labels

Comments

@frontendphil
Copy link

🐛 Bug Report

With the upgrade to 23.7.6 we started seeing type-errors that have not been there before. Namely, that the default i18n type is not compatible to what react-i18next wants. I'm unsure whether this is a react-i18next or i18next bug. I'll start here, because it appeared with a i18next update and not a react-i18next update 🤷🏻

To Reproduce

A minimal reproducible example.
You need to run the repl to get the proper type-error output

import {createInstance} from 'i18next'
import type {i18n} from 'i18next'
import 'react-i18next'

export const createClientInstance = async (): Promise<i18n> => createInstance()
@adrai
Copy link
Member

adrai commented Nov 15, 2023

You probably also use moduleResolution: bundler, right? like here?
if so, try to cast it (createInstance() as I18N)

@frontendphil
Copy link
Author

Correct. Because we're also using remix and remix-utils. I've added a @ts-expect-error to the return, which makes the function not complain about the return value. That "solves" it for me. Maybe the types get sorted in the future :)

Copy link

stale bot commented Dec 15, 2023

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.

@stale stale bot added the stale label Dec 15, 2023
@adrai
Copy link
Member

adrai commented Feb 17, 2024

should be better with newer react-i18next versions

@adrai adrai closed this as completed Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants