Skip to content

Incorrect type definitions for onSeeked and onSeeking callbacks #2031

Description

@YoussefRbahi

Environment

  • react-player: 3.4.0
  • React: 19.2.4
  • TypeScript: 5.9.3

Description
The TS definitions for the onSeeked and onSeeking callbacks don't match the actual runtime values. onSeeked is typed as a React synthetic event, and onSeeking implies an event object, but at runtime:

<ReactPlayer
  src="..."
  onSeeked={(e) => {
    // Runtime value is actually { time: number }
    console.log(e) // { time: 59 }
    
    e.currentTarget // TS thinks this exists, but it's undefined at runtime
    e.time // Works at runtime, but TS throws an error
  }}
  onSeeking={(e) => {
    // Runtime value is actually undefined
    console.log(e)  // undefined
  }}
/>

Suggested Fix
Update onSeeked to { time: number } and remove the parameter for onSeeking.

Happy to open a PR for this if it helps.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions