Next-i18next: Type 'TFunctionResult' is not assignable to type 'string'.

Created on 25 Sep 2019  路  6Comments  路  Source: isaachinman/next-i18next

Why is TFunctionResult is not assignable to 'string'?
I have to pass it as {t("my-translation") as string} as a workaround.
Does anyone know any other workarounds?

Most helpful comment

If you search across this entire repo for TFunctionResult, you will not find it. I suggest you open an issue in the appropriate repo.

All 6 comments

If you search across this entire repo for TFunctionResult, you will not find it. I suggest you open an issue in the appropriate repo.

I passed type string to t function as t is generic function like this -> t<string>("my-translation")

I ended up specifying t as any to get past this issue. No idea why it is happening and it's also not happening for all translation usage in the entire app, just a few spots.

const { t }: { t: any } = useTranslation()

It happened to us after an update of several libs, we're still trying to figure out, what's the underlying cause here, as this code has compiled this way before....

Also this comment might be of some interest? https://github.com/i18next/i18next/issues/1504#issuecomment-742727015

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nataliaroque77 picture nataliaroque77  路  3Comments

MrAvantiC picture MrAvantiC  路  3Comments

slava-lu picture slava-lu  路  6Comments

ddereszewski picture ddereszewski  路  3Comments

dimensi picture dimensi  路  4Comments