Recursively Check Array Length Until Value Changes in TypeScript

Hello, how I can recur until a value changes?, I have this dummy value but eventually this array value will come from an API,
Effect.gen(function* () {
  yield* Effect.log("Welcome to the Effect Playground!");
  return [1];
}).pipe(
  Effect.map((r) =>
    Effect.repeat(
      Effect.succeed(r),
      Schedule.recurUntil(() => r.length > 1)
    )
  ),
  Effect.runPromise
);
Was this page helpful?