Skip to content

Commit

Permalink
add Match.withReturnType api (#2568)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart committed Apr 18, 2024
1 parent 6f38dff commit a7b4b84
Show file tree
Hide file tree
Showing 4 changed files with 254 additions and 177 deletions.
18 changes: 18 additions & 0 deletions .changeset/hungry-bottles-design.md
@@ -0,0 +1,18 @@
---
"effect": patch
---

add Match.withReturnType api

Which can be used to constrain the return type of a match expression.

```ts
import { Match } from "effect"

Match.type<string>().pipe(
Match.withReturnType<string>(),
Match.when("foo", () => "foo"), // valid
Match.when("bar", () => 123), // type error
Match.else(() => "baz")
)
```

0 comments on commit a7b4b84

Please sign in to comment.