Conform more of the codebase to strictNullChecks
(#10666)
* Conform more of the codebase to `strictNullChecks` * Iterate * Iterate * Iterate * Iterate
This commit is contained in:
parent
8867f1801e
commit
93b4ee654b
17 changed files with 126 additions and 114 deletions
|
@ -91,7 +91,7 @@ export default class WhoIsTypingTile extends React.Component<IProps, IState> {
|
|||
|
||||
private onRoomTimeline = (event: MatrixEvent, room?: Room): void => {
|
||||
if (room?.roomId === this.props.room.roomId) {
|
||||
const userId = event.getSender();
|
||||
const userId = event.getSender()!;
|
||||
// remove user from usersTyping
|
||||
const usersTyping = this.state.usersTyping.filter((m) => m.userId !== userId);
|
||||
if (usersTyping.length !== this.state.usersTyping.length) {
|
||||
|
@ -200,14 +200,15 @@ export default class WhoIsTypingTile extends React.Component<IProps, IState> {
|
|||
}
|
||||
|
||||
public render(): React.ReactNode {
|
||||
let usersTyping = this.state.usersTyping;
|
||||
const stoppedUsersOnTimer = Object.keys(this.state.delayedStopTypingTimers).map((userId) =>
|
||||
this.props.room.getMember(userId),
|
||||
);
|
||||
const usersTyping = this.state.usersTyping;
|
||||
// append the users that have been reported not typing anymore
|
||||
// but have a timeout timer running so they can disappear
|
||||
// when a message comes in
|
||||
usersTyping = usersTyping.concat(stoppedUsersOnTimer);
|
||||
for (const userId in this.state.delayedStopTypingTimers) {
|
||||
const member = this.props.room.getMember(userId);
|
||||
if (member) usersTyping.push(member);
|
||||
}
|
||||
|
||||
// sort them so the typing members don't change order when
|
||||
// moved to delayedStopTypingTimers
|
||||
usersTyping.sort((a, b) => compare(a.name, b.name));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue