Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 609886c

Browse files
committed
Fix types
1 parent d5bd930 commit 609886c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/stores/AccountPasswordStore.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,22 @@ const PASSWORD_TIMEOUT = 5 * 60 * 1000; // five minutes
2222
* to avoid requestin the password all the time for instance during e2ee setup.
2323
*/
2424
export class AccountPasswordStore {
25-
private password: string = null;
26-
private passwordTimeoutId: number = null;
25+
private password?: string;
26+
private passwordTimeoutId?: ReturnType<typeof setTimeout>;
2727

2828
public setPassword(password: string): void {
2929
this.password = password;
3030
clearTimeout(this.passwordTimeoutId);
3131
this.passwordTimeoutId = setTimeout(this.clearPassword, PASSWORD_TIMEOUT);
3232
}
3333

34-
public getPassword(): string | null {
34+
public getPassword(): string | undefined {
3535
return this.password;
3636
}
3737

3838
public clearPassword = (): void => {
3939
clearTimeout(this.passwordTimeoutId);
40-
this.passwordTimeoutId = null;
41-
this.password = null;
40+
this.passwordTimeoutId = undefined;
41+
this.password = undefined;
4242
};
4343
}

test/stores/AccountPasswordStore-test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe("AccountPasswordStore", () => {
2626
});
2727

2828
it("should not have a password by default", () => {
29-
expect(accountPasswordStore.getPassword()).toBeNull();
29+
expect(accountPasswordStore.getPassword()).toBeUndefined();
3030
});
3131

3232
describe("when setting a password", () => {
@@ -44,7 +44,7 @@ describe("AccountPasswordStore", () => {
4444
});
4545

4646
it("should clear the password", () => {
47-
expect(accountPasswordStore.getPassword()).toBeNull();
47+
expect(accountPasswordStore.getPassword()).toBeUndefined();
4848
});
4949
});
5050

0 commit comments

Comments
 (0)