Options
All
  • Public
  • Public/Protected
  • All
Menu

Class used to perform never type value checks in unreachable code.

remarks

import { Debug } from 'ts-typedefs';
declare const val: string | number;

if (typeof val === 'string') {
     return null;
} else if (typeof val === 'number') {
     throw new Debug.UnreachableCodeError(val); // compiler error: val is not of type `never`
     return;
} else {
     throw new Debug.UnreachableCodeError(val); // this is ok val has `never` type here
}

Hierarchy

  • Error
    • UnreachableCodeError

Constructors

Properties

Constructors

constructor

Parameters

  • never: never

Returns UnreachableCodeError

Properties

message

message: string

name

name: string

Optional stack

stack: undefined | string

Static Error

Error: ErrorConstructor
  • Inherited
  • Protected
  • Private
  • Static
  • Module
  • Object
  • Property
  • Function
  • Variable
  • Index
  • Type
  • Class
  • Interface
  • Enum
  • Constructor
  • Getter/Setter
Made with ❤️ by pirix-gh. Documentation generated by TypeDoc.