# TS2534: A function returning 'never' cannot have a reachable end point.

> A function declared to return never can finish normally. Make every path throw or loop forever, or change the return type.

## What it means

`never` as a return type means the function never returns: every path must throw, call another
`never` function or loop forever. If execution can reach the end of the body, the declaration is
wrong.

## Example

```ts
export function fail(message: string): never {
  console.error(message);
}
```

## How to fix

- Throw at the end: `throw new Error(message)`.
- Change the return type to `void` if the function is allowed to return.

Source: https://ts-r.dev/errors/TS2534/
