Handling NoSuchElementException in TypeScript Effect Retry Logic

In this scenario
export const pollUntilIsNotEmpty = <T, E, R>(
  effect: Effect.Effect<T[], E, R>,
) =>
  effect.pipe(
    Effect.flatMap(Array.head),
    Effect.retry({
      while: isNoSuchElementException,
    }),
  );

The return type will be Effect.Effect<T, E | NoSuchElementException, R>
Shouldn't the NoSuchElementException be discarded since it will retry forever until that condition is met?
Was this page helpful?