I'm running into a similar issue. When I run tsc on our node project, I get RangeError: Maximum call stack size exceeded.
Everything was working fine - this just happens when I attempt to upgrade to typescript 4.5.3. It works fine in typescript 4.2.3.
FWIW, recursive types should definitely be allowed. They're a standard part of any programming language (more generally, Context Free Grammars) and it's very common to do this (e.g. with datastructures like trees, or compilers, etc.).
e.g. it's 100% valid to have:
type Tree<T> = { data: T; children: Tree<T>[] }
Unfortunately the stacktrace I get doesn't give me any indication of which type is causing the issue:
/Users/cbattycapps/{REDACTED}/node_modules/typescript/lib/tsc.js:94444
throw e;
^
RangeError: Maximum call stack size exceeded
at getRelationKey (/Users/cbattycapps/{REDACTED}/node_modules/typescript/lib/tsc.js:54317:32)
at recursiveTypeRelatedTo (/Users/cbattycapps/{REDACTED}/node_modules/typescript/lib/tsc.js:52985:26)
at isRelatedTo (/Users/cbattycapps/{REDACTED}/node_modules/typescript/lib/tsc.js:52645:30)
at typeRelatedToSomeType (/Users/cbattycapps/{REDACTED}/node_modules/typescript/lib/tsc.js:52869:35)
at structuredTypeRelatedToWorker (/Users/cbattycapps/{REDACTED}/node_modules/typescript/lib/tsc.js:53099:32)
at structuredTypeRelatedTo (/Users/cbattycapps/{REDACTED}/node_modules/typescript/lib/tsc.js:53084:30)
at isRelatedTo (/Users/cbattycapps/{REDACTED}/node_modules/typescript/lib/tsc.js:52642:30)
at checkTypeRelatedTo (/Users/cbattycapps/{REDACTED}/node_modules/typescript/lib/tsc.js:52314:26)
at isTypeRelatedTo (/Users/cbattycapps/{REDACTED}/node_modules/typescript/lib/tsc.js:52276:24)
at isTypeAssignableTo (/Users/cbattycapps/{REDACTED}/node_modules/typescript/lib/tsc.js:51558:20)
Originally posted by @charlescapps in #45576 (comment)
Originally posted by @charlescapps in #45576 (comment)