After updating to Typescript 4.9.5 I'm getting this error on large project. Was able to narrow it to i18next and custom definitions that supports resource types:
const resourcesStatic = {
en: {
"web.payments.payment_details": "Payment Details",
},
} as const;
declare module "i18next" {
interface CustomTypeOptions {
resources: typeof resourcesStatic;
}
}
After that tried to generate trancing and it showed, that structuredTypeRelatedTo type check was an issue from /src/utils/translations.ts that has following code
import type { TFuncKey, Namespace } from "i18next";
import { i18n } from "next-i18next";
export const lazyTranslate = <N extends Namespace>(
key: TFuncKey<N>,
ns: N,
options?: object
): string | undefined => {
return i18n?.t(key, { ns, ...options }) ?? undefined;
};