-
-
Notifications
You must be signed in to change notification settings - Fork 531
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What version of Effect is running?
3.16.8
What steps can reproduce the bug?
import { Effect, Schema } from "effect"
import { TaggedError } from "effect/Schema"
class InvalidStateError extends TaggedError<InvalidStateError>()("InvalidStateError", {
message: Schema.String
}) {}
Effect.all({
valid: Effect.filterOrFail(
Effect.succeed({ id: "123", displayName: "" }),
(user) => !user.displayName,
(_) => new InvalidStateError({ message: "User has no displayName!" })
)
})What is the expected behavior?
The program should type-check successfully.
What do you see instead?
The call to Effect.filterOrFail gives: No overload matches this call.
Additional information
Storing the Effect.filterOrFail result in a variable to the apply Effect.all does not trigger the error. So it is the direct combination of the two which causes problems.
import { Effect, Schema } from "effect"
import { TaggedError } from "effect/Schema"
class InvalidStateError extends TaggedError<InvalidStateError>()("InvalidStateError", {
message: Schema.String
}) {}
// equivalent version which type-checks
const this_is_ok = Effect.filterOrFail(
Effect.succeed({ id: "123", displayName: "" }),
(user) => !user.displayName,
(_) => new InvalidStateError({ message: "User has no displayName!" })
)
Effect.all({
valid: this_is_ok
})Repro: https://effect.website/play#73a99125caa6.
Was fine with Effect 3.14.20.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working