diff --git a/packages/i18n/src/types.ts b/packages/i18n/src/types.ts index d1f6c342..464a1301 100644 --- a/packages/i18n/src/types.ts +++ b/packages/i18n/src/types.ts @@ -62,8 +62,8 @@ export type MtcuteI18nFunction = < * other than the primary one. Used to provide type safety. */ export type OtherLanguageWrap = { - [key in keyof Strings]?: Strings[key] extends I18nValue - ? I18nValue + [key in keyof Strings]?: Strings[key] extends I18nValue + ? I18nValue : Strings[key] extends Record ? OtherLanguageWrap : never diff --git a/packages/i18n/tests/types.ts b/packages/i18n/tests/types.ts index 3e1eb4d2..56d16b3e 100644 --- a/packages/i18n/tests/types.ts +++ b/packages/i18n/tests/types.ts @@ -18,6 +18,7 @@ const ru: OtherLanguageWrap = { basic: { hello: 'Привет', // world: () => 'Мир', + // welcome: (name: number) => `Привет ${name}`, welcome: (name: string) => `Привет ${name}`, }, }