DEV Community

Discussion on: Exhaustive Type Checking with TypeScript!

Collapse
 
mindplay profile image
Rasmus Schultz

The error message you get with this "trick" is only useful if you know why you're getting it - adding a function just for the purposes of triggering a confusing compiler error?

I like this approach better:

dev.to/housinganywhere/matching-yo...

This gives more meaningful error messages, with a function that actually does something - and resembles the matching pattern from functional languages quite well. 👍