Conform more code to strictNullChecks
(#10383
* Update matrix-widget-api * Conform more code to `strictNullChecks` * Iterate
This commit is contained in:
parent
aae9dfbb7d
commit
9c816bb720
18 changed files with 112 additions and 93 deletions
|
@ -29,14 +29,11 @@ import { findDMForUser } from "./findDMForUser";
|
|||
*/
|
||||
export function findDMRoom(client: MatrixClient, targets: Member[]): Room | null {
|
||||
const targetIds = targets.map((t) => t.userId);
|
||||
let existingRoom: Room | undefined;
|
||||
let existingRoom: Room | null;
|
||||
if (targetIds.length === 1) {
|
||||
existingRoom = findDMForUser(client, targetIds[0]);
|
||||
existingRoom = findDMForUser(client, targetIds[0]) ?? null;
|
||||
} else {
|
||||
existingRoom = DMRoomMap.shared().getDMRoomForIdentifiers(targetIds);
|
||||
}
|
||||
if (existingRoom) {
|
||||
return existingRoom;
|
||||
}
|
||||
return null;
|
||||
return existingRoom;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue