TLDR: A function which runs to completion without returning anything has a return type of void, but a function which never completes execution has a return type of never.

The best way to illustrate the difference is with an example. A function which always throws an exception will never finish executing. Compare this to a function which does some work and then finishes without a return statement.

const thisThrows = (): never => {
return 'thisNeverHappens';
const thisDoesNotReturnAValue = (): void => {
someGlobal = 1 + 2;

Why does this distinction matter? It’s all down to…

Thomas James Byers

Javascript Developer — Manchester

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store