One practical application of the never
type in typescript
occurs when a function has an endpoint that is never reached. However, I'm unsure why the throw
statement specifically results in this unreachable endpoint.
function error(message: string): never {
throw new Error(message);
}
Could someone clarify this for me, please?