Conform more of the codebase to strictNullChecks + noImplicitAny (#11179)
This commit is contained in:
parent
7c211b0587
commit
a294ba2ad4
17 changed files with 104 additions and 88 deletions
|
@ -18,6 +18,7 @@ limitations under the License.
|
|||
import React from "react";
|
||||
import { AuthType, IAuthData } from "matrix-js-sdk/src/interactive-auth";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
import { MatrixClient } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { MatrixClientPeg } from "../../../MatrixClientPeg";
|
||||
import { _t } from "../../../languageHandler";
|
||||
|
@ -109,7 +110,10 @@ export default class DeactivateAccountDialog extends React.Component<IProps, ISt
|
|||
this.setState({ bodyText, continueText, continueKind });
|
||||
};
|
||||
|
||||
private onUIAuthFinished: InteractiveAuthCallback = (success, result) => {
|
||||
private onUIAuthFinished: InteractiveAuthCallback<Awaited<ReturnType<MatrixClient["deactivateAccount"]>>> = (
|
||||
success,
|
||||
result,
|
||||
) => {
|
||||
if (success) return; // great! makeRequest() will be called too.
|
||||
|
||||
if (result === ERROR_USER_CANCELLED) {
|
||||
|
|
|
@ -18,7 +18,8 @@ limitations under the License.
|
|||
|
||||
import React from "react";
|
||||
import { MatrixClient } from "matrix-js-sdk/src/client";
|
||||
import { AuthType, IAuthData } from "matrix-js-sdk/src/interactive-auth";
|
||||
import { AuthType } from "matrix-js-sdk/src/interactive-auth";
|
||||
import { UIAResponse } from "matrix-js-sdk/src/@types/uia";
|
||||
|
||||
import { _t } from "../../../languageHandler";
|
||||
import AccessibleButton from "../elements/AccessibleButton";
|
||||
|
@ -70,7 +71,7 @@ export interface InteractiveAuthDialogProps<T = unknown>
|
|||
// Default is defined in _getDefaultDialogAesthetics()
|
||||
aestheticsForStagePhases?: DialogAesthetics;
|
||||
|
||||
onFinished(success?: boolean, result?: IAuthData | Error | null): void;
|
||||
onFinished(success?: boolean, result?: UIAResponse<T> | Error | null): void;
|
||||
}
|
||||
|
||||
interface IState {
|
||||
|
@ -116,7 +117,7 @@ export default class InteractiveAuthDialog<T> extends React.Component<Interactiv
|
|||
};
|
||||
}
|
||||
|
||||
private onAuthFinished: InteractiveAuthCallback = (success, result): void => {
|
||||
private onAuthFinished: InteractiveAuthCallback<T> = (success, result): void => {
|
||||
if (success) {
|
||||
this.props.onFinished(true, result);
|
||||
} else {
|
||||
|
|
|
@ -760,7 +760,7 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
|
|||
const lookup = await MatrixClientPeg.safeGet().lookupThreePid("email", term, token);
|
||||
if (term !== this.state.filterText) return; // abandon hope
|
||||
|
||||
if (!lookup || !lookup.mxid) {
|
||||
if (!lookup || !("mxid" in lookup)) {
|
||||
// We weren't able to find anyone - we're already suggesting the plain email
|
||||
// as an alternative, so do nothing.
|
||||
return;
|
||||
|
|
|
@ -25,7 +25,7 @@ import { RoomPreviewOpts, RoomViewLifecycle } from "@matrix-org/react-sdk-module
|
|||
|
||||
import { MatrixClientPeg } from "../../../MatrixClientPeg";
|
||||
import dis from "../../../dispatcher/dispatcher";
|
||||
import { _t } from "../../../languageHandler";
|
||||
import { _t, UserFriendlyError } from "../../../languageHandler";
|
||||
import SdkConfig from "../../../SdkConfig";
|
||||
import IdentityAuthClient from "../../../IdentityAuthClient";
|
||||
import InviteReason from "../elements/InviteReason";
|
||||
|
@ -153,6 +153,9 @@ export default class RoomPreviewBar extends React.Component<IProps, IState> {
|
|||
this.props.invitedEmail,
|
||||
identityAccessToken!,
|
||||
);
|
||||
if (!("mxid" in result)) {
|
||||
throw new UserFriendlyError("Unable to find user by email");
|
||||
}
|
||||
this.setState({ invitedEmailMxid: result.mxid });
|
||||
} catch (err) {
|
||||
this.setState({ threePidFetchError: err as MatrixError });
|
||||
|
|
|
@ -32,7 +32,7 @@ const makeDeleteRequest =
|
|||
export const deleteDevicesWithInteractiveAuth = async (
|
||||
matrixClient: MatrixClient,
|
||||
deviceIds: string[],
|
||||
onFinished: InteractiveAuthCallback,
|
||||
onFinished: InteractiveAuthCallback<void>,
|
||||
): Promise<void> => {
|
||||
if (!deviceIds.length) {
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue