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

The right interface for onPointerUp 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 onPointerUp={handlePointerEvent}>{/** Some code */}</div>;
};

export default App;

Attributes that use PointerEvent: