Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit f14cc2b

Browse files
committed
Fix types
1 parent 8f3ce83 commit f14cc2b

File tree

8 files changed

+13
-11
lines changed

8 files changed

+13
-11
lines changed

src/components/structures/RoomView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2342,7 +2342,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
23422342

23432343
const showChatEffects = SettingsStore.getValue("showChatEffects");
23442344

2345-
let mainSplitBody: React.ReactFragment;
2345+
let mainSplitBody: JSX.Element;
23462346
let mainSplitContentClassName: string;
23472347
// Decide what to show in the main split
23482348
switch (this.state.mainSplitContentType) {

src/components/structures/UploadBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export default class UploadBar extends React.PureComponent<IProps, IState> {
114114
count: this.state.countFiles - 1,
115115
});
116116

117-
const uploadSize = filesize(this.state.currentTotal!);
117+
const uploadSize = filesize(this.state.currentTotal!) as string;
118118
return (
119119
<div className="mx_UploadBar">
120120
<div className="mx_UploadBar_filename">

src/components/views/dialogs/ChangelogDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export default class ChangelogDialog extends React.Component<IProps, State> {
9393
content = <Spinner key={repo} />;
9494
} else if (typeof this.state[repo] === "string") {
9595
content = _t("Unable to load commit detail: %(msg)s", {
96-
msg: this.state[repo],
96+
msg: this.state[repo] as string,
9797
});
9898
} else {
9999
content = (this.state[repo] as Commit[]).map(this.elementsForCommit);

src/components/views/dialogs/UploadConfirmDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export default class UploadConfirmDialog extends React.Component<IProps> {
115115
{preview && <div>{preview}</div>}
116116
<div id={fileId}>
117117
{placeholder}
118-
{this.props.file.name} ({filesize(this.props.file.size)})
118+
{this.props.file.name} ({filesize(this.props.file.size) as string})
119119
</div>
120120
</div>
121121
</div>

src/components/views/dialogs/UploadFailureDialog.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ export default class UploadFailureDialog extends React.Component<IProps> {
5252
"This file is <b>too large</b> to upload. " +
5353
"The file size limit is %(limit)s but this file is %(sizeOfThisFile)s.",
5454
{
55-
limit: filesize(this.props.contentMessages.getUploadLimit()),
56-
sizeOfThisFile: filesize(this.props.badFiles[0].size),
55+
limit: filesize(this.props.contentMessages.getUploadLimit()) as string,
56+
sizeOfThisFile: filesize(this.props.badFiles[0].size) as string,
5757
},
5858
{
5959
b: (sub) => <b>{sub}</b>,
@@ -71,7 +71,7 @@ export default class UploadFailureDialog extends React.Component<IProps> {
7171
message = _t(
7272
"These files are <b>too large</b> to upload. " + "The file size limit is %(limit)s.",
7373
{
74-
limit: filesize(this.props.contentMessages.getUploadLimit()),
74+
limit: filesize(this.props.contentMessages.getUploadLimit()) as string,
7575
},
7676
{
7777
b: (sub) => <b>{sub}</b>,
@@ -89,7 +89,7 @@ export default class UploadFailureDialog extends React.Component<IProps> {
8989
message = _t(
9090
"Some files are <b>too large</b> to be uploaded. " + "The file size limit is %(limit)s.",
9191
{
92-
limit: filesize(this.props.contentMessages.getUploadLimit()),
92+
limit: filesize(this.props.contentMessages.getUploadLimit()) as string,
9393
},
9494
{
9595
b: (sub) => <b>{sub}</b>,

src/components/views/messages/MFileBody.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ export default class MFileBody extends React.Component<IProps, IState> {
350350
</a>
351351
{this.context.timelineRenderingType === TimelineRenderingType.File && (
352352
<div className="mx_MImageBody_size">
353-
{this.content.info?.size ? filesize(this.content.info.size) : ""}
353+
{this.content.info?.size ? (filesize(this.content.info.size) as string) : ""}
354354
</div>
355355
)}
356356
</div>

src/languageHandler.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ export function replaceByRegexes(text: string, mapping: IVariables | Tags): stri
384384
}
385385

386386
if (shouldWrapInSpan) {
387-
return React.createElement("span", null, ...output);
387+
return React.createElement("span", null, ...(output as Array<number | string | React.ReactNode>));
388388
} else {
389389
return output.join("");
390390
}

test/i18n-test/languageHandler-test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import {
2323
setLanguage,
2424
setMissingEntryGenerator,
2525
substitute,
26+
IVariables,
27+
Tags,
2628
} from "../../src/languageHandler";
2729
import { stubClient } from "../test-utils";
2830

@@ -34,7 +36,7 @@ describe("languageHandler", function () {
3436
const plurals = "and %(count)s others...";
3537
const variableSub = "You are now ignoring %(userId)s";
3638

37-
type TestCase = [string, string, Record<string, unknown>, Record<string, unknown> | undefined, TranslatedString];
39+
type TestCase = [string, string, IVariables, Tags | undefined, TranslatedString];
3840
const testCasesEn: TestCase[] = [
3941
// description of the test case, translationString, variables, tags, expected result
4042
["translates a basic string", basicString, {}, undefined, "Rooms"],

0 commit comments

Comments
 (0)