1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +00:00

[CL-761] Enable strict template typechecking (#17334)

* enable strict template typechecking

* add callout component to module

* fixing popup action types

* fixing cipher item copy types

* fix archive cipher type

* fixing trash list items types

* fix remaining trash list item type errors

* use CipherViewLike as correct type

* change popup back directive to attribute selector

* allow undefined in popupBackAction handler

* Remove undefined from type

* fix error with firefox commercial build

---------

Co-authored-by: Vicki League <vleague@bitwarden.com>
This commit is contained in:
Bryan Cunningham
2025-11-25 11:04:37 -05:00
committed by GitHub
parent 57946f6406
commit 540da69daf
11 changed files with 84 additions and 33 deletions

View File

@@ -1,8 +1,8 @@
import { Directive, Input, OnDestroy, TemplateRef, ViewContainerRef } from "@angular/core";
import { Subject, takeUntil } from "rxjs";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { CipherAuthorizationService } from "@bitwarden/common/vault/services/cipher-authorization.service";
import { CipherViewLike } from "@bitwarden/common/vault/utils/cipher-view-like-utils";
/**
* Only shows the element if the user can delete the cipher.
@@ -15,7 +15,7 @@ export class CanDeleteCipherDirective implements OnDestroy {
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input("appCanDeleteCipher") set cipher(cipher: CipherView) {
@Input("appCanDeleteCipher") set cipher(cipher: CipherViewLike) {
this.viewContainer.clear();
this.cipherAuthorizationService

View File

@@ -36,7 +36,7 @@ export class CopyCipherFieldDirective implements OnChanges {
alias: "appCopyField",
required: true,
})
action!: Exclude<CopyAction, "hiddenField">;
action!: CopyAction;
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals

View File

@@ -3,7 +3,11 @@ export {
AtRiskPasswordCalloutData,
} from "./services/at-risk-password-callout.service";
export { PasswordRepromptService } from "./services/password-reprompt.service";
export { CopyCipherFieldService, CopyAction } from "./services/copy-cipher-field.service";
export {
CopyCipherFieldService,
CopyAction,
CopyFieldAction,
} from "./services/copy-cipher-field.service";
export { CopyCipherFieldDirective } from "./components/copy-cipher-field.directive";
export { OrgIconDirective } from "./components/org-icon.directive";
export { CanDeleteCipherDirective } from "./components/can-delete-cipher.directive";

View File

@@ -35,6 +35,12 @@ export type CopyAction =
| "publicKey"
| "keyFingerprint";
/**
* Copy actions that can be used with the appCopyField directive.
* Excludes "hiddenField" which requires special handling.
*/
export type CopyFieldAction = Exclude<CopyAction, "hiddenField">;
type CopyActionInfo = {
/**
* The i18n key for the type of field being copied. Will be used to display a toast message.