Hacker News new | ask | show | jobs
by preommr 923 days ago
> it's enabled in switch statements by either `assertNever` in the `default` case, or by limiting your function return from within switch cases with the `strictNullChecks` option enabled.

What's wrong with using if statements?

```

if(shape.key === 'rectangle'){}

else if (shape.key === 'circle') {}

else {x: never = shape} // todo: use exhaustiveCheck(x: never)

```

That's pretty clear and easy.