Forcing `Effect.filterOrFail` or TypeScript to track refinement

Is there any way to force Effect.filterOrFail, or TS, to keep track of the refinement?
Effect.filterOrFail(
    Effect.succeed(Array.fromIterable([1, 2])),
    Array.isNonEmptyReadonlyArray,
    () => new MyCustomError(),
)

This is still inferred as number[] instead of NonEmptyReadonlyArray<number>
Was this page helpful?