• Error
  • Reported by the binder
  • Reported by the lexer and parser

TS99001

Maximum nesting depth exceeded; the rest of this construct was skipped.

ts-r stopped descending into very deeply nested code to avoid running out of stack. Split the nested expression or type.

What it means

This is a ts-r code; tsc doesn't have it. ts-r's parser and binder limit how deeply they recurse into nested expressions, types and statements, so that pathological input produces a diagnostic instead of a stack overflow. When the limit is reached, the rest of that construct is skipped and this error is reported. Real code almost never gets close; it usually comes from generated files with thousands of nested parentheses, arrays or binary operators.

How to fix

  • Restructure the generated code so it nests less: build long chains in a loop or split them into several statements.
  • If ordinary code triggers it, report it as a bug with the file.