Apply strictNullChecks to src/components/views/settings (#10724)

This commit is contained in:
Kerry 2023-05-05 20:13:50 +12:00 committed by GitHub
parent a4f0b80692
commit 1f4d857283
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 772 additions and 48 deletions

View file

@ -36,7 +36,7 @@ import { Action } from "../../../dispatcher/actions";
import { ViewRoomPayload } from "../../../dispatcher/payloads/ViewRoomPayload";
import { doesRoomVersionSupport, PreferredRoomVersions } from "../../../utils/PreferredRoomVersions";
interface IProps {
export interface JoinRuleSettingsProps {
room: Room;
promptUpgrade?: boolean;
closeSettingsFn(): void;
@ -45,7 +45,7 @@ interface IProps {
aliasWarning?: ReactNode;
}
const JoinRuleSettings: React.FC<IProps> = ({
const JoinRuleSettings: React.FC<JoinRuleSettingsProps> = ({
room,
promptUpgrade,
aliasWarning,
@ -287,7 +287,10 @@ const JoinRuleSettings: React.FC<IProps> = ({
fn(_t("Upgrading room"), 0, total);
} else if (!progress.roomSynced) {
fn(_t("Loading new room"), 1, total);
} else if (progress.inviteUsersProgress < progress.inviteUsersTotal) {
} else if (
progress.inviteUsersProgress !== undefined &&
progress.inviteUsersProgress < progress.inviteUsersTotal
) {
fn(
_t("Sending invites... (%(progress)s out of %(count)s)", {
progress: progress.inviteUsersProgress,
@ -296,13 +299,16 @@ const JoinRuleSettings: React.FC<IProps> = ({
2 + progress.inviteUsersProgress,
total,
);
} else if (progress.updateSpacesProgress < progress.updateSpacesTotal) {
} else if (
progress.updateSpacesProgress !== undefined &&
progress.updateSpacesProgress < progress.updateSpacesTotal
) {
fn(
_t("Updating spaces... (%(progress)s out of %(count)s)", {
progress: progress.updateSpacesProgress,
count: progress.updateSpacesTotal,
}),
2 + progress.inviteUsersProgress + progress.updateSpacesProgress,
2 + (progress.inviteUsersProgress ?? 0) + progress.updateSpacesProgress,
total,
);
}