From 5f540eb25c31d4524a9a1cbc2f706ed7dbadfa4b Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 3 Nov 2022 12:50:07 +0000 Subject: [PATCH] Update types to match js-sdk --strict mode (#9528) Co-authored-by: Michael Weimann --- src/components/structures/InteractiveAuth.tsx | 4 ++-- src/components/structures/auth/Registration.tsx | 4 ++-- src/components/views/dialogs/DeactivateAccountDialog.tsx | 2 +- test/toasts/IncomingLegacyCallToast-test.tsx | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/structures/InteractiveAuth.tsx b/src/components/structures/InteractiveAuth.tsx index 4342355c74..c1f723c63a 100644 --- a/src/components/structures/InteractiveAuth.tsx +++ b/src/components/structures/InteractiveAuth.tsx @@ -64,7 +64,7 @@ interface IProps { continueText?: string; continueKind?: string; // callback - makeRequest(auth: IAuthData): Promise; + makeRequest(auth: IAuthData | null): Promise; // callback called when the auth process has finished, // successfully or unsuccessfully. // @param {boolean} status True if the operation requiring @@ -199,7 +199,7 @@ export default class InteractiveAuthComponent extends React.Component => { + private requestCallback = (auth: IAuthData | null, background: boolean): Promise => { // This wrapper just exists because the js-sdk passes a second // 'busy' param for backwards compat. This throws the tests off // so discard it here. diff --git a/src/components/structures/auth/Registration.tsx b/src/components/structures/auth/Registration.tsx index c155b5acc2..0ab90abb49 100644 --- a/src/components/structures/auth/Registration.tsx +++ b/src/components/structures/auth/Registration.tsx @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { AuthType, createClient } from 'matrix-js-sdk/src/matrix'; +import { AuthType, createClient, IAuthData } from 'matrix-js-sdk/src/matrix'; import React, { Fragment, ReactNode } from 'react'; import { MatrixClient } from "matrix-js-sdk/src/client"; import classNames from "classnames"; @@ -443,7 +443,7 @@ export default class Registration extends React.Component { }); }; - private makeRegisterRequest = auth => { + private makeRegisterRequest = (auth: IAuthData | null) => { const registerParams = { username: this.state.formVals.username, password: this.state.formVals.password, diff --git a/src/components/views/dialogs/DeactivateAccountDialog.tsx b/src/components/views/dialogs/DeactivateAccountDialog.tsx index 0eb81c932b..028c196c10 100644 --- a/src/components/views/dialogs/DeactivateAccountDialog.tsx +++ b/src/components/views/dialogs/DeactivateAccountDialog.tsx @@ -115,7 +115,7 @@ export default class DeactivateAccountDialog extends React.Component { + private onUIAuthComplete = (auth: IAuthData | null): void => { // XXX: this should be returning a promise to maintain the state inside the state machine correct // but given that a deactivation is followed by a local logout and all object instances being thrown away // this isn't done. diff --git a/test/toasts/IncomingLegacyCallToast-test.tsx b/test/toasts/IncomingLegacyCallToast-test.tsx index a0fdfae56f..bdd2636094 100644 --- a/test/toasts/IncomingLegacyCallToast-test.tsx +++ b/test/toasts/IncomingLegacyCallToast-test.tsx @@ -39,7 +39,7 @@ describe('', () => { const mockRoom = new Room('!room:server.org', mockClient, userId); mockClient.deviceId = deviceId; - const call = new MatrixCall({ client: mockClient }); + const call = new MatrixCall({ client: mockClient, roomId: mockRoom.roomId }); const defaultProps = { call, };