Skip to content

Support for type guards #1565

Discussion options

You must be logged in to vote

fold from boolean module works with booleans, so the type level information of a type guard is lost. What you're doing is pattern matching with a variable, so I suggest you to use libraries like ts-pattern or ts-adt.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by florianbepunkt
Comment options

You must be logged in to vote
1 reply
@PatrykWalach
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants