Conform more of the codebase to strict typing (#11195)

This commit is contained in:
Michael Telatynski 2023-07-07 09:02:13 +01:00 committed by GitHub
parent f32b9bab99
commit 285847560b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 59 additions and 59 deletions

View file

@ -566,7 +566,7 @@ export default class RoomSublist extends React.Component<IProps, IState> {
let isAlphabetical = RoomListStore.instance.getTagSorting(this.props.tagId) === SortAlgorithm.Alphabetic;
let isUnreadFirst = RoomListStore.instance.getListOrder(this.props.tagId) === ListAlgorithm.Importance;
if (this.slidingSyncMode) {
const slidingList = SlidingSyncManager.instance.slidingSync.getListParams(this.props.tagId);
const slidingList = SlidingSyncManager.instance.slidingSync?.getListParams(this.props.tagId);
isAlphabetical = (slidingList?.sort || [])[0] === "by_name";
isUnreadFirst = (slidingList?.sort || [])[0] === "by_notification_level";
}

View file

@ -16,7 +16,7 @@ limitations under the License.
*/
import React from "react";
import { IThreepid, ThreepidMedium } from "matrix-js-sdk/src/@types/threepids";
import { ThreepidMedium } from "matrix-js-sdk/src/@types/threepids";
import { logger } from "matrix-js-sdk/src/logger";
import { MatrixError } from "matrix-js-sdk/src/matrix";
@ -25,7 +25,7 @@ import { MatrixClientPeg } from "../../../../MatrixClientPeg";
import Field from "../../elements/Field";
import AccessibleButton, { ButtonEvent } from "../../elements/AccessibleButton";
import * as Email from "../../../../email";
import AddThreepid from "../../../../AddThreepid";
import AddThreepid, { ThirdPartyIdentifier } from "../../../../AddThreepid";
import Modal from "../../../../Modal";
import ErrorDialog, { extractErrorMessageFromError } from "../../dialogs/ErrorDialog";
@ -42,8 +42,8 @@ that is available.
*/
interface IExistingEmailAddressProps {
email: IThreepid;
onRemoved: (emails: IThreepid) => void;
email: ThirdPartyIdentifier;
onRemoved: (emails: ThirdPartyIdentifier) => void;
}
interface IExistingEmailAddressState {
@ -130,8 +130,8 @@ export class ExistingEmailAddress extends React.Component<IExistingEmailAddressP
}
interface IProps {
emails: IThreepid[];
onEmailsChange: (emails: Partial<IThreepid>[]) => void;
emails: ThirdPartyIdentifier[];
onEmailsChange: (emails: ThirdPartyIdentifier[]) => void;
}
interface IState {
@ -153,7 +153,7 @@ export default class EmailAddresses extends React.Component<IProps, IState> {
};
}
private onRemoved = (address: IThreepid): void => {
private onRemoved = (address: ThirdPartyIdentifier): void => {
const emails = this.props.emails.filter((e) => e !== address);
this.props.onEmailsChange(emails);
};

View file

@ -16,14 +16,14 @@ limitations under the License.
*/
import React from "react";
import { IThreepid, ThreepidMedium } from "matrix-js-sdk/src/@types/threepids";
import { ThreepidMedium } from "matrix-js-sdk/src/@types/threepids";
import { logger } from "matrix-js-sdk/src/logger";
import { _t, UserFriendlyError } from "../../../../languageHandler";
import { MatrixClientPeg } from "../../../../MatrixClientPeg";
import Field from "../../elements/Field";
import AccessibleButton, { ButtonEvent } from "../../elements/AccessibleButton";
import AddThreepid from "../../../../AddThreepid";
import AddThreepid, { ThirdPartyIdentifier } from "../../../../AddThreepid";
import CountryDropdown from "../../auth/CountryDropdown";
import Modal from "../../../../Modal";
import ErrorDialog, { extractErrorMessageFromError } from "../../dialogs/ErrorDialog";
@ -37,8 +37,8 @@ This is a copy/paste of EmailAddresses, mostly.
// TODO: Combine EmailAddresses and PhoneNumbers to be 3pid agnostic
interface IExistingPhoneNumberProps {
msisdn: IThreepid;
onRemoved: (phoneNumber: IThreepid) => void;
msisdn: ThirdPartyIdentifier;
onRemoved: (phoneNumber: ThirdPartyIdentifier) => void;
}
interface IExistingPhoneNumberState {
@ -125,8 +125,8 @@ export class ExistingPhoneNumber extends React.Component<IExistingPhoneNumberPro
}
interface IProps {
msisdns: IThreepid[];
onMsisdnsChange: (phoneNumbers: Partial<IThreepid>[]) => void;
msisdns: ThirdPartyIdentifier[];
onMsisdnsChange: (phoneNumbers: ThirdPartyIdentifier[]) => void;
}
interface IState {
@ -156,7 +156,7 @@ export default class PhoneNumbers extends React.Component<IProps, IState> {
};
}
private onRemoved = (address: IThreepid): void => {
private onRemoved = (address: ThirdPartyIdentifier): void => {
const msisdns = this.props.msisdns.filter((e) => e !== address);
this.props.onMsisdnsChange(msisdns);
};

View file

@ -16,14 +16,13 @@ limitations under the License.
*/
import React from "react";
import { IThreepid } from "matrix-js-sdk/src/@types/threepids";
import { logger } from "matrix-js-sdk/src/logger";
import { MatrixError } from "matrix-js-sdk/src/matrix";
import { _t, UserFriendlyError } from "../../../../languageHandler";
import { MatrixClientPeg } from "../../../../MatrixClientPeg";
import Modal from "../../../../Modal";
import AddThreepid, { Binding } from "../../../../AddThreepid";
import AddThreepid, { Binding, ThirdPartyIdentifier } from "../../../../AddThreepid";
import ErrorDialog, { extractErrorMessageFromError } from "../../dialogs/ErrorDialog";
import SettingsSubsection from "../shared/SettingsSubsection";
import InlineSpinner from "../../elements/InlineSpinner";
@ -46,7 +45,7 @@ TODO: Reduce all the copying between account vs. discovery components.
*/
interface IEmailAddressProps {
email: IThreepid;
email: ThirdPartyIdentifier;
}
interface IEmailAddressState {
@ -259,7 +258,7 @@ export class EmailAddress extends React.Component<IEmailAddressProps, IEmailAddr
}
}
interface IProps {
emails: IThreepid[];
emails: ThirdPartyIdentifier[];
isLoading?: boolean;
}

View file

@ -16,14 +16,13 @@ limitations under the License.
*/
import React from "react";
import { IThreepid } from "matrix-js-sdk/src/@types/threepids";
import { logger } from "matrix-js-sdk/src/logger";
import { MatrixError } from "matrix-js-sdk/src/matrix";
import { _t, UserFriendlyError } from "../../../../languageHandler";
import { MatrixClientPeg } from "../../../../MatrixClientPeg";
import Modal from "../../../../Modal";
import AddThreepid, { Binding } from "../../../../AddThreepid";
import AddThreepid, { Binding, ThirdPartyIdentifier } from "../../../../AddThreepid";
import ErrorDialog, { extractErrorMessageFromError } from "../../dialogs/ErrorDialog";
import Field from "../../elements/Field";
import SettingsSubsection from "../shared/SettingsSubsection";
@ -38,7 +37,7 @@ This is a copy/paste of EmailAddresses, mostly.
// TODO: Combine EmailAddresses and PhoneNumbers to be 3pid agnostic
interface IPhoneNumberProps {
msisdn: IThreepid;
msisdn: ThirdPartyIdentifier;
}
interface IPhoneNumberState {
@ -274,7 +273,7 @@ export class PhoneNumber extends React.Component<IPhoneNumberProps, IPhoneNumber
}
interface IProps {
msisdns: IThreepid[];
msisdns: ThirdPartyIdentifier[];
isLoading?: boolean;
}

View file

@ -61,6 +61,7 @@ import { SettingsSubsectionHeading } from "../../shared/SettingsSubsectionHeadin
import Heading from "../../../typography/Heading";
import InlineSpinner from "../../../elements/InlineSpinner";
import MatrixClientContext from "../../../../../contexts/MatrixClientContext";
import { ThirdPartyIdentifier } from "../../../../../AddThreepid";
interface IProps {
closeSettingsFn: () => void;
@ -87,8 +88,8 @@ interface IState {
agreedUrls: string[];
resolve: (values: string[]) => void;
};
emails: IThreepid[];
msisdns: IThreepid[];
emails: ThirdPartyIdentifier[];
msisdns: ThirdPartyIdentifier[];
loading3pids: boolean; // whether or not the emails and msisdns have been loaded
canChangePassword: boolean;
idServerName?: string;
@ -156,11 +157,11 @@ export default class GeneralUserSettingsTab extends React.Component<IProps, ISta
}
};
private onEmailsChange = (emails: IThreepid[]): void => {
private onEmailsChange = (emails: ThirdPartyIdentifier[]): void => {
this.setState({ emails });
};
private onMsisdnsChange = (msisdns: IThreepid[]): void => {
private onMsisdnsChange = (msisdns: ThirdPartyIdentifier[]): void => {
this.setState({ msisdns });
};