Unexpected Type Inference Behavior with `Effect.filterOrElse`

Found something I thought was off with Effect.filterOrElse: https://effect.website/play/#b9b2ac4a8053
import { Data, Effect } from "effect"

type FooBar = Data.TaggedEnum<{
  Foo: {}
  Bar: {}
}>

const Foobar = Data.taggedEnum<FooBar>()

const value = Foobar.Foo() as FooBar

const ok = Effect.succeed(value).pipe(
  Effect.filterOrFail(Foobar.$is("Bar")),
  // I am correctly inferred as Bar
  Effect.map((bar) => bar)
)

const wierd = Effect.succeed(value).pipe(
  // My else branch thinks I am Foo or Bar still, expected Foo
  Effect.filterOrElse(Foobar.$is("Bar"), (foo) => Effect.succeed(foo))
)
Was this page helpful?