Repository navigation
Compiler crash with RangeError: Map maximum size exceeded #61493
Description
🔎 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
Activity
MartinJohns commentedon 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.
liyanch commentedon Mar 27, 2025
But our team can't plan to update the TypeScript version temporarily. Anyway, I ask them for help to fix the problem.
RyanCavanaugh commentedon Mar 27, 2025
Doesn't repro on 5.8.
We are not able to provide support for older versions of TypeScript
typescript-bot commentedon Mar 30, 2025
This issue has been marked as "Unactionable" and has seen no recent activity. It has been automatically closed for house-keeping purposes.