From 0d9aece78c7b5d250aa2a6593bfbb2793bd0c7ce Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Wed, 22 Feb 2023 10:15:46 +0100 Subject: [PATCH] Fix types --- src/stores/AccountPasswordStore.ts | 10 +++++----- test/stores/AccountPasswordStore-test.ts | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/stores/AccountPasswordStore.ts b/src/stores/AccountPasswordStore.ts index 051f58b7aa19..60f15258fcab 100644 --- a/src/stores/AccountPasswordStore.ts +++ b/src/stores/AccountPasswordStore.ts @@ -22,8 +22,8 @@ const PASSWORD_TIMEOUT = 5 * 60 * 1000; // five minutes * to avoid requestin the password all the time for instance during e2ee setup. */ export class AccountPasswordStore { - private password: string = null; - private passwordTimeoutId: number = null; + private password: string | undefined; + private passwordTimeoutId: number | undefined; public setPassword(password: string): void { this.password = password; @@ -31,13 +31,13 @@ export class AccountPasswordStore { this.passwordTimeoutId = setTimeout(this.clearPassword, PASSWORD_TIMEOUT); } - public getPassword(): string | null { + public getPassword(): string | undefined { return this.password; } public clearPassword = (): void => { clearTimeout(this.passwordTimeoutId); - this.passwordTimeoutId = null; - this.password = null; + this.passwordTimeoutId = undefined; + this.password = undefined; }; } diff --git a/test/stores/AccountPasswordStore-test.ts b/test/stores/AccountPasswordStore-test.ts index 86b836932515..f54886fd1b98 100644 --- a/test/stores/AccountPasswordStore-test.ts +++ b/test/stores/AccountPasswordStore-test.ts @@ -26,7 +26,7 @@ describe("AccountPasswordStore", () => { }); it("should not have a password by default", () => { - expect(accountPasswordStore.getPassword()).toBeNull(); + expect(accountPasswordStore.getPassword()).toBeUndefined(); }); describe("when setting a password", () => { @@ -44,7 +44,7 @@ describe("AccountPasswordStore", () => { }); it("should clear the password", () => { - expect(accountPasswordStore.getPassword()).toBeNull(); + expect(accountPasswordStore.getPassword()).toBeUndefined(); }); });