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

The right interface for onTransitionEnd is AnimationEvent

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

Interface

interface TransitionEvent<T = Element> extends SyntheticEvent<T, NativeTransitionEvent> {
    elapsedTime: number;
    propertyName: string;
    pseudoElement: string;
}

Full example

import React, { TransitionEvent } from 'react';

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

  return <div onTransitionEnd={handleTransitionEvent}>{/** Some code */}</div>;
};

export default App;

Attributes that use AnimationEvent: