this post was submitted on 15 Mar 2024
13 points (93.3% liked)

TypeScript

809 readers
1 users here now

founded 1 year ago
MODERATORS
 

Today I'm sharing a little trick that I like to use to make switch statements cleaner and more type-safe. Happy to hear other ideas!

you are viewing a single comment's thread
view the rest of the comments
[–] sloppy_diffuser@sh.itjust.works 2 points 6 months ago

There is support for this in Effect as another implementation.

https://effect.website/docs/guides/style/pattern-matching