Skip to content

Commit

Permalink
Made some type improvement.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuznietsov committed Jun 22, 2021
1 parent fc8574b commit 8613a24
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/plugins/expressions/common/expression_renderers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ export class DefaultInterpreterRenderHandlers<Emitters = {}> implements IInterpr
hasCompatibleActions?: (event: any) => Promise<boolean>;

on(event: keyof Emitters | keyof DefaultEmitters<this>, fn: (...args: any) => void): void {
if (this[event as keyof this]) {
const eventCall = this[event as keyof this];
const eventName = event as keyof this;
if (this[eventName]) {
const eventCall = this[eventName];
if (!eventCall || typeof eventCall !== 'function') return;

const updatedEvent = (...args: unknown[]) => {
Expand All @@ -109,7 +110,7 @@ export class DefaultInterpreterRenderHandlers<Emitters = {}> implements IInterpr
}
return preventFromCallingListener;
};
this[event as keyof this] = (updatedEvent as unknown) as typeof eventCall;
this[eventName] = (updatedEvent as unknown) as typeof eventCall;
}
}

Expand Down

0 comments on commit 8613a24

Please sign in to comment.