Better HN
topnewbestaskshowjobs
Log inSign up

terminatornet3

1 karma · joined Jun 30, 2026 (5mo ago) · 2 submissions

Submissions

comment 5mo ago · link · parent

you don't need a runtime error if you have a compiler error. best of luck with your PR

comment 5mo ago · link · parent

The original author is correct. Their implementation of an exhaustive check will give you a compiler error if you miss a variant in your switch statement. I much prefer a compiler error over a run time error.

It's even recommended in the official typescript docs - https://www.typescriptlang.org/docs/handbook/2/narrowing.htm...