fix(i18n): enforce same arg types in OtherLanguageWrap
This commit is contained in:
parent
b7d0b85a15
commit
d4040a768f
2 changed files with 3 additions and 2 deletions
|
@ -62,8 +62,8 @@ export type MtcuteI18nFunction<Strings, Input> = <
|
|||
* other than the primary one. Used to provide type safety.
|
||||
*/
|
||||
export type OtherLanguageWrap<Strings> = {
|
||||
[key in keyof Strings]?: Strings[key] extends I18nValue
|
||||
? I18nValue
|
||||
[key in keyof Strings]?: Strings[key] extends I18nValue<infer A>
|
||||
? I18nValue<A>
|
||||
: Strings[key] extends Record<string, any>
|
||||
? OtherLanguageWrap<Strings[key]>
|
||||
: never
|
||||
|
|
|
@ -18,6 +18,7 @@ const ru: OtherLanguageWrap<typeof en> = {
|
|||
basic: {
|
||||
hello: 'Привет',
|
||||
// world: () => 'Мир',
|
||||
// welcome: (name: number) => `Привет ${name}`,
|
||||
welcome: (name: string) => `Привет ${name}`,
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue