Skip to content

Stack overflow in recursive type #20772

@evmar

Description

@evmar

TypeScript Version: playground, [email protected]
Code

type Recur = () => Recur.B;

Expected behavior:
Compile error.

Actual behavior:
Stack overflow.

.../node_modules/typescript/lib/tsc.js:59609
                throw e;
                ^

RangeError: Maximum call stack size exceeded
    at resolveEntityName (.../node_modules/typescript/lib/tsc.js:20834:35)
    at resolveEntityName (.../node_modules/typescript/lib/tsc.js:20859:33)
    at resolveTypeReferenceName (.../node_modules/typescript/lib/tsc.js:25382:20)
    at getTypeFromTypeReference (.../node_modules/typescript/lib/tsc.js:25481:30)
    at getTypeFromTypeNode (.../node_modules/typescript/lib/tsc.js:26360:28)
    at getSignatureReturnTypeFromDeclaration (.../node_modules/typescript/lib/tsc.js:24997:24)
    at getSignatureFromDeclaration (.../node_modules/typescript/lib/tsc.js:24964:34)
    at getSignaturesOfSymbol (.../node_modules/typescript/lib/tsc.js:25062:37)
    at resolveAnonymousTypeMembers (.../node_modules/typescript/lib/tsc.js:24311:38)
    at resolveStructuredTypeMembers (.../node_modules/typescript/lib/tsc.js:24458:25)

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions