Skip to content

Commit c4472dc

Browse files
authored
chore(eslint-config): re-enable no-unsafe-declaration-merging rule COMPASS-9459 (#7044)
1 parent 32c815b commit c4472dc

File tree

2 files changed

+28
-20
lines changed

2 files changed

+28
-20
lines changed

configs/eslint-config-compass/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ const extraTsRules = {
2727
'@typescript-eslint/no-base-to-string': 'warn',
2828
'@typescript-eslint/unbound-method': 'warn',
2929
'@typescript-eslint/no-duplicate-type-constituents': 'warn',
30-
'@typescript-eslint/no-unsafe-declaration-merging': 'warn',
3130
};
3231

3332
const tsRules = {

packages/compass-components/src/components/guide-cue/guide-cue-service.ts

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,14 @@ export type ShowCueEventDetail = CustomEvent<{
1616
groupId?: GroupName;
1717
}>;
1818

19+
type CustomEventListenerOrEventListenerObject<E> =
20+
| { handleEvent: (evt: E) => void }
21+
| ((evt: E) => void);
22+
1923
interface GuideCueEventMap {
2024
'show-cue': ShowCueEventDetail;
2125
}
2226

23-
export interface GuideCueService extends EventTarget {
24-
addEventListener<K extends keyof GuideCueEventMap>(
25-
type: K,
26-
listener: (this: GuideCueEventMap, ev: GuideCueEventMap[K]) => void
27-
): void;
28-
addEventListener(
29-
type: string,
30-
listener: EventListenerOrEventListenerObject
31-
): void;
32-
removeEventListener<K extends keyof GuideCueEventMap>(
33-
type: K,
34-
listener: (this: GuideCueEventMap, ev: GuideCueEventMap[K]) => void
35-
): void;
36-
removeEventListener(
37-
type: string,
38-
listener: EventListenerOrEventListenerObject
39-
): void;
40-
}
41-
4227
export type Cue = {
4328
groupId?: GroupName;
4429
step: number;
@@ -261,6 +246,30 @@ export class GuideCueService extends EventTarget {
261246
return this.onNext();
262247
}
263248
}
249+
250+
addEventListener<K extends keyof GuideCueEventMap>(
251+
type: K,
252+
listener: CustomEventListenerOrEventListenerObject<
253+
GuideCueEventMap[K]
254+
> | null
255+
): void {
256+
return super.addEventListener(
257+
type,
258+
listener as EventListenerOrEventListenerObject
259+
);
260+
}
261+
262+
removeEventListener<K extends keyof GuideCueEventMap>(
263+
type: K,
264+
listener: CustomEventListenerOrEventListenerObject<
265+
GuideCueEventMap[K]
266+
> | null
267+
): void {
268+
return super.removeEventListener(
269+
type,
270+
listener as EventListenerOrEventListenerObject
271+
);
272+
}
264273
}
265274

266275
export const guideCueService = new GuideCueService(

0 commit comments

Comments
 (0)