logoalt Hacker News

rtpgtoday at 12:51 AM0 repliesview on HN

The thing you gotta make sure to do is basically return inside of switch statements. Typescript will gladly propagate a type that you think is never but is actually ThatOneCaseYouForgot if it's not ever used or referred to.

Every TS project I've worked on has an assertNever(val) thing specifically to check for this kinda stuff