Skip to content

Commit

Permalink
better types, fix #1794
Browse files Browse the repository at this point in the history
  • Loading branch information
lavrton committed Jul 18, 2024
1 parent 7b99aa9 commit e6cb27f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,19 @@ type NodeEventMap = GlobalEventHandlersEventMap & {
[index: string]: any;
};

export interface KonvaEventObject<EventType> {
export interface KonvaEventObject<EventType, This = Node> {
type: string;
target: Shape | Stage;
evt: EventType;
pointerId: number;
currentTarget: Node;
currentTarget: This;
cancelBubble: boolean;
child?: Node;
}

export type KonvaEventListener<This, EventType> = (
this: This,
ev: KonvaEventObject<EventType>
ev: KonvaEventObject<EventType, This>
) => void;

/**
Expand Down Expand Up @@ -814,7 +814,7 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
var targets = evt.target.findAncestors(selector, true, stopNode);
for (var i = 0; i < targets.length; i++) {
evt = Util.cloneObject(evt);
evt.currentTarget = targets[i];
evt.currentTarget = targets[i] as any;
handler.call(targets[i], evt as any);
}
});
Expand Down

0 comments on commit e6cb27f

Please sign in to comment.