gvergnaud / ts-pattern

🎨 The exhaustive Pattern Matching library for TypeScript, with smart type inference.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ts-pattern promise handler doc or explanation on README.md

fatihaziz opened this issue · comments

Is your feature request related to a problem? Please describe.
It is unsure ts-pattern support for promise handlers, because neither on the GIF, on README nor issues mentioning promise handler.
so I tried it myself,
its work, the result typing also resulting as expected, exhaustive work as expected.
https://stackblitz.com/edit/typescript-qcrlpv?file=index.ts

Describe the solution you'd like
A clear guide on README.md that the handler can be promise too.

Describe alternatives you've considered
No alternative

Additional context
I like ts-pattern as it's simpler than conventional if branches (for some use case that has complex conditional branches).
I like to make a PR to update README.md and add example too about this.