vime-js / vime

Customizable, extensible, accessible and framework agnostic media player. Modern alternative to Video.js and Plyr. Supports HTML5, HLS, Dash, YouTube, Vimeo, Dailymotion...
https://vimejs.com
MIT License
2.75k stars 154 forks source link

React setCurrentTime Type 'Number' has no call signatures. #323

Open oakcreations opened 2 years ago

oakcreations commented 2 years ago

This error happens during project build tsdx 0.14.1 & @vime/react: 5.3.1

My code:

  const ref = useRef<HTMLVmPlayerElement>(null);
  const [currentTime, setCurrentTime] = usePlayerContext(ref, 'currentTime', 0);
  const [duration] = usePlayerContext(ref, 'duration', -1);

  const onTapBackward = () => {
      if (currentTime < seconds) setCurrentTime(0);
      setCurrentTime(currentTime - seconds);
  };

This error happens when it hits the setCurrentTime line

semantic error TS2349: This expression is not callable. Type 'Number' has no call signatures.