@eagleoutice/flowr - v2.10.1
    Preparing search index...

    Function assertUnreachable

    • Verifies, that the given code path is never reached.

      Parameters

      • x: never

      Returns never

      type Shape = Circle | Square;
      function area(s: Shape): number {
      switch(s.type) {
      case 'circle': return Math.PI * s.radius ** 2;
      case 'square': return s.sideLength ** 2;
      default: return assertUnreachable(s); // ensures that all cases are covered
      }
      }