Skip to content
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

prefer-immutable-types causes ESLint to crash on matrices #875

Open
Tim-W-James opened this issue Mar 4, 2024 · 1 comment
Open

prefer-immutable-types causes ESLint to crash on matrices #875

Tim-W-James opened this issue Mar 4, 2024 · 1 comment

Comments

@Tim-W-James
Copy link

Tim-W-James commented Mar 4, 2024

const myFunction = (x: number[][]): string => {
  return 0;
};

Causes the rule to crash:

Oops! Something went wrong! :(

ESLint: 8.56.0

RangeError: Maximum call stack size exceeded
Occurred while linting .../src/index.ts:1
Rule: "functional/prefer-immutable-types"
    at TypeObject.hasOwn (<anonymous>)
    at Function.hasOwn (<anonymous>)
    at isTypeNode (.../is-immutable-type/dist/index.cjs:287:19)
    at .../is-immutable-type/dist/index.cjs:246:30
    at Array.map (<anonymous>)
    at typeArgumentsToString (.../is-immutable-type/dist/index.cjs:245:47)
    at TypeName.getNameWithArguments (.../is-immutable-type/dist/index.cjs:171:54)
    at .../is-immutable-type/dist/index.cjs:253:26
    at Array.map (<anonymous>)
    at typeArgumentsToString (.../node_modules/is-immutable-type/dist/index.cjs:245:47)

While it doesn't crash with a single-depth array number[]

const myFunction = (x: number[]): string => {
  return 0;
};
@danielnixon
Copy link
Owner

Good catch, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants