What is the TypeScript definition for the onPointerMove event in React?

The right interface for onPointerMove is PointerEvent

Please continue reading below to see how to use it or read my guide on using React's events with TypeScript.

Interface

interface PointerEvent<T = Element> extends MouseEvent<T, NativePointerEvent> {
    pointerId: number;
    pressure: number;
    tangentialPressure: number;
    tiltX: number;
    tiltY: number;
    twist: number;
    width: number;
    height: number;
    pointerType: 'mouse' | 'pen' | 'touch';
    isPrimary: boolean;
}

Full example

import React, { PointerEvent } from 'react';

const App = () => {
  const handlePointerEvent = (e: PointerEvent<HTMLDivElement>) => {
    // Do something
  };

  return <div onPointerMove={handlePointerEvent}>{/** Some code */}</div>;
};

export default App;

Attributes that use PointerEvent: