July 2018
Intermediate to advanced
420 pages
8h 46m
English
The never type was introduced in TypeScript 2.0; it implies a value that never occurs. At first glance, it may seem strange, but it can be used in some situations.
Let's look at what the official documentation says about it:
Suppose that a messaging function that is called within another function specifies the callback.
It would look something like the following code:
const myMessage = (text: string): never => { throw new Error(text);}const myError = () => Error('Some text here');Another example would be checking ...
Read now
Unlock full access