Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

We actually use this version of never a lot in our code at $WORK

```

export function never(message?: string): never {

  throw new Error(message ?? 'Reached an impossible state');
}

const [foo = never()] = dbQueryThatReturnsOne();

```

I guess it's en par with .unwrap()





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: