Use never to make sure all values are covered

Given is a set of limited values (enum Color) and a function that should handle all of those values (getHex):

enum Color {

function getHex(color: Color): string {
  switch(color) {
    case Color.RED:
      return '#ff0000';
    case Color.GREEN:
      return '#008000';
      assertUnreachable(color); // <- Argument of type 'Color' is not assignable to parameter of type 'never'

function assertUnreachable(value: never): never {
  throw new Error(`The value ${value} is not expected by getHex()`);

Thanks to the never type we are informed during compile time that we forgot about Color.BLUE.