Conform more of the code base to strict null checking (#10147)

* Conform more of the code base to strict null checking

* More strict fixes

* More strict work

* Fix missing optional type

* Iterate
This commit is contained in:
Michael Telatynski 2023-02-13 17:01:43 +00:00 committed by GitHub
parent fa036a5080
commit da7aa4055e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
380 changed files with 682 additions and 694 deletions

View file

@ -31,10 +31,10 @@ import { determineCreateRoomEncryptionOption, Member } from "../../../src/utils/
* @returns {Promise<LocalRoom>} Resolves to the new local room
*/
export async function createDmLocalRoom(client: MatrixClient, targets: Member[]): Promise<LocalRoom> {
const userId = client.getUserId();
const userId = client.getUserId()!;
const localRoom = new LocalRoom(LOCAL_ROOM_ID_PREFIX + client.makeTxnId(), client, userId);
const events = [];
const events: MatrixEvent[] = [];
events.push(
new MatrixEvent({
@ -121,7 +121,7 @@ export async function createDmLocalRoom(client: MatrixClient, targets: Member[])
localRoom.updateMyMembership("join");
localRoom.addLiveEvents(events);
localRoom.currentState.setStateEvents(events);
localRoom.name = localRoom.getDefaultRoomName(client.getUserId());
localRoom.name = localRoom.getDefaultRoomName(client.getUserId()!);
client.store.storeRoom(localRoom);
return localRoom;