1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-09 21:20:27 +00:00

Remove ts-strict-ignore and fix strict typing errors

This commit is contained in:
Alec Rippberger
2025-04-08 13:53:55 -05:00
parent 4be617dfb1
commit db47b68795
3 changed files with 11 additions and 9 deletions

View File

@@ -1,5 +1,3 @@
// FIXME: Update this file to be type safe and remove this and next line
// @ts-strict-ignore
import { ChangeDetectorRef, Component, NgZone, OnDestroy, OnInit, inject } from "@angular/core";
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
import { NavigationEnd, Router, RouterOutlet } from "@angular/router";
@@ -46,8 +44,8 @@ import { DesktopSyncVerificationDialogComponent } from "./components/desktop-syn
export class AppComponent implements OnInit, OnDestroy {
private compactModeService = inject(PopupCompactModeService);
private lastActivity: Date;
private activeUserId: UserId;
private lastActivity: Date | null = null;
private activeUserId: UserId | null = null;
private recordActivitySubject = new Subject<void>();
private routerAnimations = false;
@@ -85,7 +83,7 @@ export class AppComponent implements OnInit, OnDestroy {
await this.clearComponentStates();
this.accountService.activeAccount$.pipe(takeUntil(this.destroy$)).subscribe((account) => {
this.activeUserId = account?.id;
this.activeUserId = account?.id ?? null;
});
this.authService.activeAccountStatus$
@@ -186,7 +184,9 @@ export class AppComponent implements OnInit, OnDestroy {
await this.clearComponentStates();
}
if (url.startsWith("/tabs/")) {
await this.cipherService.setAddEditCipherInfo(null, this.activeUserId);
if (this.activeUserId) {
await this.cipherService.setAddEditCipherInfo(null, this.activeUserId);
}
}
(window as any).previousPopupUrl = url;

View File

@@ -56,7 +56,9 @@ export class VaultBrowserStateService {
return await firstValueFrom(this.vaultBrowserGroupingsComponentState$);
}
async setBrowserGroupingsComponentState(value: BrowserGroupingsComponentState): Promise<void> {
async setBrowserGroupingsComponentState(
value: BrowserGroupingsComponentState | null,
): Promise<void> {
await this.activeUserVaultBrowserGroupingsComponentState.update(() => value, {
shouldUpdate: (current) => !(current == null && value == null),
});
@@ -66,7 +68,7 @@ export class VaultBrowserStateService {
return await firstValueFrom(this.vaultBrowserComponentState$);
}
async setBrowserVaultItemsComponentState(value: BrowserComponentState): Promise<void> {
async setBrowserVaultItemsComponentState(value: BrowserComponentState | null): Promise<void> {
await this.activeUserVaultBrowserComponentState.update(() => value, {
shouldUpdate: (current) => !(current == null && value == null),
});

View File

@@ -198,7 +198,7 @@ export abstract class CipherService implements UserKeyRotationDataProvider<Ciphe
abstract restoreWithServer(id: string, userId: UserId, asAdmin?: boolean): Promise<any>;
abstract restoreManyWithServer(ids: string[], orgId?: string): Promise<void>;
abstract getKeyForCipherKeyDecryption(cipher: Cipher, userId: UserId): Promise<any>;
abstract setAddEditCipherInfo(value: AddEditCipherInfo, userId: UserId): Promise<void>;
abstract setAddEditCipherInfo(value: AddEditCipherInfo | null, userId: UserId): Promise<void>;
/**
* Returns user ciphers re-encrypted with the new user key.
* @param originalUserKey the original user key