From 0330efd4dcc3e905036ceb68fd5e6db3f513d3d7 Mon Sep 17 00:00:00 2001 From: teidesu <86301490+teidesu@users.noreply.github.com> Date: Tue, 19 Jul 2022 03:11:08 +0300 Subject: [PATCH] fix(i18n): support FormattedString totally forgot about it --- packages/i18n/src/types.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/i18n/src/types.ts b/packages/i18n/src/types.ts index eb19c394..dce7d90f 100644 --- a/packages/i18n/src/types.ts +++ b/packages/i18n/src/types.ts @@ -1,9 +1,12 @@ -import { ParsedUpdate } from '@mtcute/client' +import { FormattedString, ParsedUpdate } from '@mtcute/client' type Values = T[keyof T] type SafeGet = T extends Record ? T[K] : never -export type I18nValue = string | ((...args: any[]) => string) +export type I18nValue = + | string + | FormattedString + | ((...args: any[]) => string | FormattedString) type NestedKeysDelimited = Values<{ [key in Extract]: T[key] extends I18nValue @@ -28,7 +31,7 @@ export type MtcuteI18nFunction = < lang: ParsedUpdate['data'] | string | null, key: K, ...params: ExtractParameter -) => string +) => string | FormattedString export type OtherLanguageWrap = { [key in keyof Strings]?: Strings[key] extends I18nValue