Search⌘ K

Using the never type

In this lesson, we'll learn about the 'never' type and how it is different from the 'void' type.

We'll cover the following...

An example #

The code below is an arrow function expression that contains an infinite loop where a message is output to the console:

TypeScript 3.3.4
const keepLogging = (message: string) => {
while (true) {
console.log(message);
}
}

What do you think ...