Skip to content

Compiler crash with RangeError: Map maximum size exceeded #61493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
liyanch opened this issue Mar 27, 2025 · 4 comments
Closed

Compiler crash with RangeError: Map maximum size exceeded #61493

liyanch opened this issue Mar 27, 2025 · 4 comments
Labels
Unactionable There isn't something we can do with this issue

Comments

@liyanch
Copy link

liyanch commented Mar 27, 2025

🔎 Search Terms

RangeError: Map maximum size exceeded.

PS: The problem seems as the content of links, #55630 and #53192. But there is not same as the problem. I hope I can get the correct answer to solve the error.

🕗 Version & Regression Information

  • This changed between versions v4.9.5.
  • I was unable to test this on prior versions because the compilation tool is based on v4.9.5. and most products are based on this compilation tool.

⏯ Playground Link

No response

💻 Code

// Your code here
// Like this, but not same as this.
// For details, see the error reporting function of the error stack.
type Digits = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
type T1 = `${Digits}${Digits}${Digits}${Digits}` | undefined;
type T2 = { a: string } | { b: number };

export function f1(x: T1 | null, y: T1 & T2) {
x = y; // Excessive complexity error
}

// Or like this
type Digits = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
type T9XXXX = `9${Digits}${Digits}${Digits}${Digits}`;
type TXXXXX = `${Exclude<Digits, '0'>}${Digits}${Digits}${Digits}${Digits}`;
let x: Exclude<TXXXXX, T9XXXX> = '88888';

🙁 Actual behavior

The error stack information is as follows:
RangeError: Map maximum size exceeded
at Map.set ()
at recursiveTypeRelatedTo (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/typescript.js:68762:30)
at isRelatedTo (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/typescript.js:68255:25)
at checkTypeRelatedTo (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/typescript.js:67869:26)
at isTypeRelatedTo (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/typescript.js:67809:24)
at removeSubtypes (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/typescript.js:64284:33)
at getUnionType (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/typescript.js:64388:31)
at checkArrayLiteral (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/typescript.js:76781:17)
at checkExpressionWorker (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/typescript.js:83794:28)
at checkExpression (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/typescript.js:83713:38)

hvigor ERROR: BUILD FAILED in 3 min 20 s 692 ms

Process finished with exit code -1

🙂 Expected behavior

hvigor SUCCESS: BUILD SUCCESSFUL in 3 min 20 s 692 ms

Process finished with exit code 0

Additional information about the issue

No response

@MartinJohns
Copy link
Contributor

You might want to investigate if updating your TypeScript version is an option. The one you use is over two years old. I'm no team member, but I highly doubt they'll spend resources on backporting a potential fix to such an old version.

@liyanch
Copy link
Author

liyanch commented Mar 27, 2025

You might want to investigate if updating your TypeScript version is an option. The one you use is over two years old. I'm no team member, but I highly doubt they'll spend resources on backporting a potential fix to such an old version.

But our team can't plan to update the TypeScript version temporarily. Anyway, I ask them for help to fix the problem.

@RyanCavanaugh RyanCavanaugh added the Unactionable There isn't something we can do with this issue label Mar 27, 2025
@RyanCavanaugh
Copy link
Member

Doesn't repro on 5.8.

We are not able to provide support for older versions of TypeScript

@typescript-bot
Copy link
Collaborator

This issue has been marked as "Unactionable" and has seen no recent activity. It has been automatically closed for house-keeping purposes.

@typescript-bot typescript-bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Unactionable There isn't something we can do with this issue
Projects
None yet
Development

No branches or pull requests

4 participants