镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Compiler crash with RangeError: Map maximum size exceeded #61493

Closed as not planned

Description

@liyanch

🔎 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

  1. MartinJohns commented on Mar 27, 2025

    @MartinJohns
    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.

  2. liyanch commented on Mar 27, 2025

    @liyanch
    Author

    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.

  3. RyanCavanaugh commented on Mar 27, 2025

    @RyanCavanaugh
    Member

    Doesn't repro on 5.8.

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

  4. typescript-bot commented on Mar 30, 2025

    @typescript-bot
    Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    UnactionableThere isn't something we can do with this issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions