ealmansi/set-interval-async

clear interval from setIntervalAsync inside

Closed this issue · 1 comments

For some reason the setIntervalAsync throws an error in this code:

  const checkStatus = async () => {
    const processQueueId = setIntervalAsync(async () => {
      const { value } = await ...
      if (!value.includes(null)) {
          (async () => {
            await clearIntervalAsync(processQueueId);
            setStatuses(value);
            console.log('Stopped!');
          })();
      }
    }, 1000);
  }

processQueueId is not of the type that clearIntervalAsync expect to receive.

Am I doing something wrong?

@shuffledex This issue is now fixed in v2.0.3. Your snippet should now continue to work correctly.

Thank you a lot for your report and apologies for the inconvenience!