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

@ -66,7 +66,7 @@ function renderComponent(component: TestRenderer.ReactTestRenderer): string {
}
if (!Array.isArray(object) && object["type"] !== undefined && typeof object["children"] !== undefined) {
return serializeObject(object.children);
return serializeObject(object.children!);
}
if (!Array.isArray(object)) {
@ -80,7 +80,7 @@ function renderComponent(component: TestRenderer.ReactTestRenderer): string {
.join("");
};
return serializeObject(component.toJSON());
return serializeObject(component.toJSON()!);
}
describe("TextForEvent", () => {
@ -219,12 +219,12 @@ describe("TextForEvent", () => {
};
beforeAll(() => {
mockClient = createTestClient();
mockClient = createTestClient() as Mocked<MatrixClient>;
MatrixClientPeg.get = () => mockClient;
mockClient.getRoom.mockClear().mockReturnValue(mockRoom);
mockRoom.getMember
.mockClear()
.mockImplementation((userId) => [userA, userB, userC].find((u) => u.userId === userId));
.mockImplementation((userId) => [userA, userB, userC].find((u) => u.userId === userId) || null);
(SettingsStore.getValue as jest.Mock).mockReturnValue(true);
});