Skip to content

Regression from 4.2 to 4.3 : RangeError: Maximum call stack size exceeded #45632

Closed
@JSteunou

Description

@JSteunou

Bug Report

Since TypeScript 4.3 we are unable to run TypeScript check on our projet (more than 10.000 ts modules)
We are trying to upgrade from TypeScript 4.0 to 4.4 and stuck on 4.2

The error is quite generic RangeError: Maximum call stack size exceeded

If there is a way to get more log or to see which module trigger this behavior it would help a lot!

Maybe close to #44281?

🔎 Search Terms

  • 4.3
  • 4.4
  • RangeError: Maximum call stack size exceeded
  • Circular dependency
  • Recursive

🕗 Version & Regression Information

  • This changed between versions 4.2 and 4.3 (still present in next / 4.5-dev)

⏯ Playground Link

Sorry no playground I'm unable to isolate the part linked to the bug

💻 Code

// We can quickly address your report if:
//  - The code sample is short. Nearly all TypeScript bugs can be demonstrated in 20-30 lines of code!
//  - It doesn't use external libraries. These are often issues with the type definitions rather than TypeScript bugs.
//  - The incorrectness of the behavior is readily apparent from reading the sample.
// Reports are slower to investigate if:
//  - We have to pare too much extraneous code.
//  - We have to clone a large repo and validate that the problem isn't elsewhere.
//  - The sample is confusing or doesn't clearly demonstrate what's wrong.

🙁 Actual behavior

 tsc --noEmit --project tsconfig.ci.json
/project/node_modules/typescript/lib/tsc.js:90672
                throw e;
                ^

RangeError: Maximum call stack size exceeded
    at checkExpressionWorker (/project/node_modules/typescript/lib/tsc.js:62461:39)
    at checkExpression (/project/node_modules/typescript/lib/tsc.js:62428:38)
    at getTypeOfExpression (/project/node_modules/typescript/lib/tsc.js:62382:24)
    at getMatchingUnionConstituentForObjectLiteral (/project/node_modules/typescript/lib/tsc.js:54126:40)
    at discriminateContextualTypeByObjectMembers (/project/node_modules/typescript/lib/tsc.js:56777:20)
    at getApparentTypeOfContextualType (/project/node_modules/typescript/lib/tsc.js:56789:93)
    at getContextualTypeForObjectLiteralElement (/project/node_modules/typescript/lib/tsc.js:56696:24)
    at getContextualType (/project/node_modules/typescript/lib/tsc.js:56855:28)
    at hasContextualTypeWithNoGenericTypes (/project/node_modules/typescript/lib/tsc.js:55760:17)
    at getNarrowableTypeForReference (/project/node_modules/typescript/lib/tsc.js:55766:53)
error Command failed with exit code 1.

🙂 Expected behavior

no error :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs More InfoThe issue still hasn't been fully clarified

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions