News for hackers. Stuff that matters.
Re:Greppability is an underrated code metric by chipsrafferty on Thursday September 05, 2024 @04:51PM (#41460310)
I'd say that writing this example from the article is a pretty big downside, especially if you had e.g. 20 different cases and not just 2.

```ts const getTableName = (addressType: 'shipping' | 'billing') => { if (addressType === 'shipping') { return 'shipping_addresses' } if (addressType === 'billing') { return 'billing_addresses' } throw new TypeError('addressType must be billing or shipping') } ```

There are no comments on this comment yet.