Skip to content

Schedule.recurWhile not inferring types with Effect.repeat #6251

@justinsmid

Description

@justinsmid

What version of Effect is running?

3.21.2

What steps can reproduce the bug?

In the following code, data in the recurWhile callback is being inferred as unknown instead of string.
Note that it does work as expected at runtime.

https://effect.website/play/#d94447d949fd

import { Effect, Schedule } from "effect"

const program = Effect.sync(() => {
  console.log("Running...")
  return "foo"
}).pipe(
  Effect.repeat(
    Schedule.recurWhile((data) => data === "foo").pipe(
      Schedule.addDelay(() => "1 second")
    )
  )
)

Effect.runPromise(program)

What is the expected behavior?

I would expect data in the recurWhile callback to be inferred as string

What do you see instead?

It is inferred as unknown

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions