From 7ac1a37cb24800a572d4149eeb8b94e8ef5925df Mon Sep 17 00:00:00 2001 From: Ryan Miller Date: Mon, 2 Sep 2024 11:02:30 +1000 Subject: [PATCH] chore: fix type issues --- ts/models/message.ts | 3 +++ ts/util/i18n/functions/getMessage.ts | 22 ++++++++++------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/ts/models/message.ts b/ts/models/message.ts index abe223c8c..d735072f9 100644 --- a/ts/models/message.ts +++ b/ts/models/message.ts @@ -1272,6 +1272,7 @@ export class MessageModel extends Backbone.Model { this.getConversation()?.getNicknameOrRealUsernameOrPlaceholder() || window.i18n('unknown'); if (groupUpdate.left) { + // @ts-expect-error -- TODO: Fix by using new i18n builder const { token, args } = getLeftGroupUpdateChangeStr(groupUpdate.left, groupName); // TODO: clean up this typing return window.i18n.stripped(...([token, args] as GetMessageArgs)); @@ -1282,12 +1283,14 @@ export class MessageModel extends Backbone.Model { } if (groupUpdate.joined?.length) { + // @ts-expect-error -- TODO: Fix by using new i18n builder const { token, args } = getJoinedGroupUpdateChangeStr(groupUpdate.joined, groupName); // TODO: clean up this typing return window.i18n.stripped(...([token, args] as GetMessageArgs)); } if (groupUpdate.kicked?.length) { + // @ts-expect-error -- TODO: Fix by using new i18n builder const { token, args } = getKickedGroupUpdateStr(groupUpdate.kicked, groupName); // TODO: clean up this typing return window.i18n.stripped(...([token, args] as GetMessageArgs)); diff --git a/ts/util/i18n/functions/getMessage.ts b/ts/util/i18n/functions/getMessage.ts index 6c7159c7d..2521b663b 100644 --- a/ts/util/i18n/functions/getMessage.ts +++ b/ts/util/i18n/functions/getMessage.ts @@ -4,8 +4,6 @@ import type { LocalizerToken, LocalizerDictionary, GetMessageArgs, - ArgsRecord, - DictionaryWithoutPluralStrings, SetupI18nReturnType, } from '../../../types/Localizer'; import { i18nLog } from '../shared'; @@ -15,16 +13,16 @@ import { inEnglish } from './inEnglish'; import { stripped } from './stripped'; import { localizeFromOld, type StringArgsRecord } from '../localizedString'; -/** - * Checks if a string contains a dynamic variable. - * @param localizedString - The string to check. - * @returns `true` if the string contains a dynamic variable, otherwise `false`. - * - * TODO: Change this to a proper type assertion when the type is fixed. - */ -const isStringWithArgs = ( - localizedString: string -): localizedString is R => localizedString.includes('{'); +// /** +// * Checks if a string contains a dynamic variable. +// * @param localizedString - The string to check. +// * @returns `true` if the string contains a dynamic variable, otherwise `false`. +// * +// * TODO: Change this to a proper type assertion when the type is fixed. +// */ +// const isStringWithArgs = ( +// localizedString: string +// ): localizedString is R => localizedString.includes('{'); /** * Retrieves a localized message string, substituting variables where necessary.