-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
TypeScript Version: 2.3 and up
Code
class SelfReference<T = SelfReference<string>> {}Expected behavior:
The compiler either accepts it (so that new SelfReference() has the type SelfReference<SelfReference<string>>) or rejects it (by explicitly disallowing a circular reference in default type parameters).
Actual behavior:
The compiler goes into an infinite loop that exceeds the recursion limit:
RangeError: Maximum call stack size exceeded
at resolveNameHelper (typescript\lib\typescript.js:26480:35)
at resolveName (typescript\lib\typescript.js:26478:20)
at resolveEntityName (typescript\lib\typescript.js:27128:26)
at getTypeFromTypeReference (typescript\lib\typescript.js:31874:54)
at getTypeFromTypeNode (typescript\lib\typescript.js:32724:28)
at getDefaultFromTypeParameter (typescript\lib\typescript.js:31032:66)
⋮
NaridaL
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue