When attempting to retrieve the X position of my mouse in an Angular2 Directive using the following code:
@HostListener('mousemove', ['$event'])
onMousemove(event: Event): void {
console.log(event.clientX)
}
I encountered an error stating that
"Property 'clientX' does not exist on type 'Event'."
This situation seemed peculiar because when I modified the listener to log out the event object like this:
@HostListener('mousemove', ['$event'])
onMousemove(event: Event): void {
console.log(event)
}
it successfully displayed the event object.
https://i.sstatic.net/e3g3H.png
Why am I unable to access event.clientX
?