diff --git a/src/components/structures/RoomView.tsx b/src/components/structures/RoomView.tsx index e2614cb2df3..8e4d7210447 100644 --- a/src/components/structures/RoomView.tsx +++ b/src/components/structures/RoomView.tsx @@ -2342,7 +2342,7 @@ export class RoomView extends React.Component { const showChatEffects = SettingsStore.getValue("showChatEffects"); - let mainSplitBody: React.ReactFragment; + let mainSplitBody: JSX.Element; let mainSplitContentClassName: string; // Decide what to show in the main split switch (this.state.mainSplitContentType) { diff --git a/src/components/structures/UploadBar.tsx b/src/components/structures/UploadBar.tsx index c87ad4754f9..6034bf690de 100644 --- a/src/components/structures/UploadBar.tsx +++ b/src/components/structures/UploadBar.tsx @@ -114,7 +114,7 @@ export default class UploadBar extends React.PureComponent { count: this.state.countFiles - 1, }); - const uploadSize = filesize(this.state.currentTotal!); + const uploadSize = filesize(this.state.currentTotal!) as string; return (
diff --git a/src/components/views/dialogs/ChangelogDialog.tsx b/src/components/views/dialogs/ChangelogDialog.tsx index 8321cc40f49..845698cc315 100644 --- a/src/components/views/dialogs/ChangelogDialog.tsx +++ b/src/components/views/dialogs/ChangelogDialog.tsx @@ -93,7 +93,7 @@ export default class ChangelogDialog extends React.Component { content = ; } else if (typeof this.state[repo] === "string") { content = _t("Unable to load commit detail: %(msg)s", { - msg: this.state[repo], + msg: this.state[repo] as string, }); } else { content = (this.state[repo] as Commit[]).map(this.elementsForCommit); diff --git a/src/components/views/dialogs/UploadConfirmDialog.tsx b/src/components/views/dialogs/UploadConfirmDialog.tsx index 584015e1603..526e02efbb8 100644 --- a/src/components/views/dialogs/UploadConfirmDialog.tsx +++ b/src/components/views/dialogs/UploadConfirmDialog.tsx @@ -115,7 +115,7 @@ export default class UploadConfirmDialog extends React.Component { {preview &&
{preview}
}
{placeholder} - {this.props.file.name} ({filesize(this.props.file.size)}) + {this.props.file.name} ({filesize(this.props.file.size) as string})
diff --git a/src/components/views/dialogs/UploadFailureDialog.tsx b/src/components/views/dialogs/UploadFailureDialog.tsx index 2bec57dd0d9..43e7af51684 100644 --- a/src/components/views/dialogs/UploadFailureDialog.tsx +++ b/src/components/views/dialogs/UploadFailureDialog.tsx @@ -52,8 +52,8 @@ export default class UploadFailureDialog extends React.Component { "This file is too large to upload. " + "The file size limit is %(limit)s but this file is %(sizeOfThisFile)s.", { - limit: filesize(this.props.contentMessages.getUploadLimit()), - sizeOfThisFile: filesize(this.props.badFiles[0].size), + limit: filesize(this.props.contentMessages.getUploadLimit()) as string, + sizeOfThisFile: filesize(this.props.badFiles[0].size) as string, }, { b: (sub) => {sub}, @@ -71,7 +71,7 @@ export default class UploadFailureDialog extends React.Component { message = _t( "These files are too large to upload. " + "The file size limit is %(limit)s.", { - limit: filesize(this.props.contentMessages.getUploadLimit()), + limit: filesize(this.props.contentMessages.getUploadLimit()) as string, }, { b: (sub) => {sub}, @@ -89,7 +89,7 @@ export default class UploadFailureDialog extends React.Component { message = _t( "Some files are too large to be uploaded. " + "The file size limit is %(limit)s.", { - limit: filesize(this.props.contentMessages.getUploadLimit()), + limit: filesize(this.props.contentMessages.getUploadLimit()) as string, }, { b: (sub) => {sub}, diff --git a/src/components/views/messages/MFileBody.tsx b/src/components/views/messages/MFileBody.tsx index b90f02c2cd7..1fc080b5905 100644 --- a/src/components/views/messages/MFileBody.tsx +++ b/src/components/views/messages/MFileBody.tsx @@ -350,7 +350,7 @@ export default class MFileBody extends React.Component { {this.context.timelineRenderingType === TimelineRenderingType.File && (
- {this.content.info?.size ? filesize(this.content.info.size) : ""} + {this.content.info?.size ? (filesize(this.content.info.size) as string) : ""}
)} diff --git a/src/languageHandler.tsx b/src/languageHandler.tsx index ec37d329657..dfc84e11b25 100644 --- a/src/languageHandler.tsx +++ b/src/languageHandler.tsx @@ -384,7 +384,7 @@ export function replaceByRegexes(text: string, mapping: IVariables | Tags): stri } if (shouldWrapInSpan) { - return React.createElement("span", null, ...output); + return React.createElement("span", null, ...(output as Array)); } else { return output.join(""); } diff --git a/test/i18n-test/languageHandler-test.tsx b/test/i18n-test/languageHandler-test.tsx index 66c88fe5679..0368fe99602 100644 --- a/test/i18n-test/languageHandler-test.tsx +++ b/test/i18n-test/languageHandler-test.tsx @@ -23,6 +23,8 @@ import { setLanguage, setMissingEntryGenerator, substitute, + IVariables, + Tags, } from "../../src/languageHandler"; import { stubClient } from "../test-utils"; @@ -34,7 +36,7 @@ describe("languageHandler", function () { const plurals = "and %(count)s others..."; const variableSub = "You are now ignoring %(userId)s"; - type TestCase = [string, string, Record, Record | undefined, TranslatedString]; + type TestCase = [string, string, IVariables, Tags | undefined, TranslatedString]; const testCasesEn: TestCase[] = [ // description of the test case, translationString, variables, tags, expected result ["translates a basic string", basicString, {}, undefined, "Rooms"],