Remove all generic CustomEvents
In the referenced bug we have identified generic CustomEvent as being
harmful. It is similar to allowing `any` as a type.
This is just a random Friday cleanup for technical excellence.
After this change there is only one match for this regexp, which has an
associated TODO: ([^w].|^)CustomEvent([^<]|$)
Release-Notes: skip
Google-Bug-Id: b/265892992
Change-Id: Iff1fb96101900d924533bcecb638cc68174a3462
diff --git a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts
index f3c23aa..da49af0 100644
--- a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts
+++ b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts
@@ -116,7 +116,11 @@
import {sharedStyles} from '../../../styles/shared-styles';
import {when} from 'lit/directives/when.js';
import {classMap} from 'lit/directives/class-map.js';
-import {ValueChangedEvent} from '../../../types/events';
+import {
+ AddReviewerEvent,
+ RemoveReviewerEvent,
+ ValueChangedEvent,
+} from '../../../types/events';
import {customElement, property, state, query} from 'lit/decorators.js';
import {subscribe} from '../../lit/subscription-controller';
import {configModelToken} from '../../../models/config/config-model';
@@ -723,17 +727,19 @@
// Plugins on reply-reviewers endpoint can take advantage of these
// events to add / remove reviewers
- this.addEventListener('add-reviewer', e => {
+ this.addEventListener('add-reviewer', (e: AddReviewerEvent) => {
+ const reviewer = e.detail.reviewer;
// Only support account type, see more from:
// elements/shared/gr-account-list/gr-account-list.js#addAccountItem
this.reviewersList?.addAccountItem({
- account: (e as CustomEvent).detail.reviewer,
+ account: reviewer,
count: 1,
});
});
- this.addEventListener('remove-reviewer', e => {
- this.reviewersList?.removeAccount((e as CustomEvent).detail.reviewer);
+ this.addEventListener('remove-reviewer', (e: RemoveReviewerEvent) => {
+ const reviewer = e.detail.reviewer;
+ this.reviewersList?.removeAccount(reviewer);
});
}