Improve typing around event emitter handlers (#7816)

This commit is contained in:
Michael Telatynski 2022-02-22 12:18:08 +00:00 committed by GitHub
parent 213b32bf14
commit 7fa01ffb06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
79 changed files with 548 additions and 471 deletions

View file

@ -17,6 +17,7 @@ limitations under the License.
import React from 'react';
import { GuestAccess, HistoryVisibility, JoinRule, RestrictedAllowType } from "matrix-js-sdk/src/@types/partials";
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
import { RoomStateEvent } from "matrix-js-sdk/src/models/room-state";
import { EventType } from 'matrix-js-sdk/src/@types/event';
import { logger } from "matrix-js-sdk/src/logger";
@ -71,7 +72,7 @@ export default class SecurityRoomSettingsTab extends React.Component<IProps, ISt
// TODO: [REACT-WARNING] Move this to constructor
UNSAFE_componentWillMount() { // eslint-disable-line
const cli = MatrixClientPeg.get();
cli.on("RoomState.events", this.onStateEvent);
cli.on(RoomStateEvent.Events, this.onStateEvent);
const room = cli.getRoom(this.props.roomId);
const state = room.currentState;
@ -110,7 +111,7 @@ export default class SecurityRoomSettingsTab extends React.Component<IProps, ISt
}
componentWillUnmount() {
MatrixClientPeg.get().removeListener("RoomState.events", this.onStateEvent);
MatrixClientPeg.get().removeListener(RoomStateEvent.Events, this.onStateEvent);
}
private onStateEvent = (e: MatrixEvent) => {