Replace `fireEvent` by `fire`
This seems to be more consistent and clearer to use. But also it enables
us to check that the type of the event detail as declared in
`HTMLElementEventMap` is actually `{}`.
I could not get this to work with an optional parameter, but I think
it is actually fine to force callers to add `{}` as a parameter to
`fire()` calls.
Release-Notes: skip
Change-Id: I6d7eb523f6a4d2d98d0ed3016f3bc7cd9c74c8fa
diff --git a/polygerrit-ui/app/elements/shared/gr-linked-chip/gr-linked-chip.ts b/polygerrit-ui/app/elements/shared/gr-linked-chip/gr-linked-chip.ts
index e48dcb3..7717683 100644
--- a/polygerrit-ui/app/elements/shared/gr-linked-chip/gr-linked-chip.ts
+++ b/polygerrit-ui/app/elements/shared/gr-linked-chip/gr-linked-chip.ts
@@ -6,7 +6,7 @@
import '../gr-button/gr-button';
import '../gr-icon/gr-icon';
import '../gr-limited-text/gr-limited-text';
-import {fireEvent} from '../../../utils/event-util';
+import {fire} from '../../../utils/event-util';
import {sharedStyles} from '../../../styles/shared-styles';
import {LitElement, css, html} from 'lit';
import {customElement, property} from 'lit/decorators.js';
@@ -15,6 +15,11 @@
interface HTMLElementTagNameMap {
'gr-linked-chip': GrLinkedChip;
}
+ interface HTMLElementEventMap {
+ /** Fired when the 'remove' button was clicked. */
+ // prettier-ignore
+ 'remove': CustomEvent<{}>;
+ }
}
@customElement('gr-linked-chip')
@@ -101,6 +106,6 @@
private handleRemoveTap(e: Event) {
e.preventDefault();
- fireEvent(this, 'remove');
+ fire(this, 'remove', {});
}
}