import { Match, String, Predicate } from "effect";
const result = Match.value(mockMessage).pipe(
Match.when({ id: String.startsWith("optimistic") }, () => "optimistic" as const),
Match.when({ readAt: Predicate.isNotNullable }, () => "read-by-user" as const),
Match.orElse(() => "pending" as const),
) satisfies "read-by-user" | "pending" | "optimistic";
import { Match, String, Predicate } from "effect";
const result = Match.value(mockMessage).pipe(
Match.when({ id: String.startsWith("optimistic") }, () => "optimistic" as const),
Match.when({ readAt: Predicate.isNotNullable }, () => "read-by-user" as const),
Match.orElse(() => "pending" as const),
) satisfies "read-by-user" | "pending" | "optimistic";