TypeScript: Disabling unreachable code detection partially for the condition completeness check

I want to disable the unreachable code detection for the condition completeness check.

function f(n) {
  switch(n) {
    case 0: return 0;
    default: return 1;
  }
  // comment base disabling
  // @unreachable
  assert(false); // remove by unassert tools before the release
  throw new Error();
}

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 16 (15 by maintainers)

Most upvoted comments

I think this would be better served by a lint tool, but others can weigh in on this.

also you can just use --allowUnreachableCode