c/typescript · by 8hob@programming.dev · 1yA Type-Safer Alternative to Type Guards in TypeScript https://8hob.io/posts/type-safer-alternative-type-guards/A trick that I'd like sharing :) 18 points · 2 comments · view on lemmy.world
2 Comments
sloppy_diffuser@sh.itjust.works · 3 pts · 1y
There are libraries that do just this like https://effect.website/docs/guides/schema/introduction.
Appreciate the write up though! All too easy to rely on libraries without understanding what's under the hood.
Thanks for sharing, it was a good read.
8hob@programming.dev · 3 pts · 1y
Using a third-party library when it's applicable definitely works. Much of this post is for those who can't add a heavy dependency :)