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

Bug: [prefer-readonly-parameter-types] isTypeReadonly stack overflow #5875

Closed
4 tasks done
sviat9440 opened this issue Oct 24, 2022 · 1 comment · Fixed by #5876
Closed
4 tasks done

Bug: [prefer-readonly-parameter-types] isTypeReadonly stack overflow #5875

sviat9440 opened this issue Oct 24, 2022 · 1 comment · Fixed by #5876
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@sviat9440
Copy link
Contributor

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Playground Link

https://typescript-eslint.io/play/#ts=4.8.4&sourceType=module&code=JYOwLgpgTgZghgYwgAgCoQM5mQbwLABQyyUEcAJgPYgA2AnsgNoDWEdAXMllKAOYC6ndFgCMAbkIBfQoVCRYiFMLAjchYqQrV6TVhy5geIAUMxgJBaQSA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Y6RAM0Wls4CGAEwD2TeIXRRe0EdEjgwAXxBKgA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA

Repro Code

interface Test {
  readonly [key: string]: Test1;
}

interface Test1 {
  readonly [key: string]: Test;
}

ESLint Config

module.exports = {
  parser: "@typescript-eslint/parser",
  rules: {},
};

tsconfig

{
  "compilerOptions": {}
}

Expected Result

isTypeReadonly for type Test should return true

Actual Result

Error:

RangeError: Maximum call stack size exceeded
    at getReducedApparentType (C:\Users\User\IdeaProjects\typescript-eslint\node_modules\typescript\lib\typescript.js:59926:40)
    at Object.getPropertiesOfType (C:\Users\User\IdeaProjects\typescript-eslint\node_modules\typescript\lib\typescript.js:59550:20)
    at TypeObject.Object.<anonymous>.TypeObject.getProperties (C:\Users\User\IdeaProjects\typescript-eslint\node_modules\typescript\lib\typescript.js:166905:33)
    at getProperties (C:\Users\User\IdeaProjects\typescript-eslint\packages\type-utils\src\isTypeReadonly.ts:131:27)
    at isTypeReadonlyObject (C:\Users\User\IdeaProjects\typescript-eslint\packages\type-utils\src\isTypeReadonly.ts:301:28)
    at isTypeReadonlyRecurser (C:\Users\User\IdeaProjects\typescript-eslint\packages\type-utils\src\isTypeReadonly.ts:120:14)
    at checkIndexSignature (C:\Users\User\IdeaProjects\typescript-eslint\packages\type-utils\src\isTypeReadonly.ts:203:36)
    at isTypeReadonlyObject (C:\Users\User\IdeaProjects\typescript-eslint\packages\type-utils\src\isTypeReadonly.ts:301:28)
    at isTypeReadonlyRecurser (C:\Users\User\IdeaProjects\typescript-eslint\packages\type-utils\src\isTypeReadonly.ts:120:14)
    at checkIndexSignature (C:\Users\User\IdeaProjects\typescript-eslint\packages\type-utils\src\isTypeReadonly.ts:203:36)
    at isTypeReadonlyObject (C:\Users\User\IdeaProjects\typescript-eslint\packages\type-utils\src\isTypeReadonly.ts:301:28)
    at isTypeReadonlyRecurser (C:\Users\User\IdeaProjects\typescript-eslint\packages\type-utils\src\isTypeReadonly.ts:120:14)
    at checkIndexSignature (C:\Users\User\IdeaProjects\typescript-eslint\packages\type-utils\src\isTypeReadonly.ts:203:36)

Additional Info

Related to #4476.

Versions

Not relevant

@sviat9440 sviat9440 added bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Oct 24, 2022
@JoshuaKGoldberg JoshuaKGoldberg added accepting prs Go ahead, send a pull request that resolves this issue and removed triage Waiting for maintainers to take a look labels Oct 24, 2022
@JoshuaKGoldberg
Copy link
Member

❤️‍🔥 thanks for filing!

sviat9440 added a commit to MillerSvt/typescript-eslint that referenced this issue Oct 24, 2022
JoshuaKGoldberg added a commit that referenced this issue Nov 2, 2022
Co-authored-by: Josh Goldberg <git@joshuakgoldberg.com>
crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this issue Nov 10, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint) | devDependencies | patch | [`5.42.0` -> `5.42.1`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/5.42.0/5.42.1) |
| [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint) | devDependencies | patch | [`5.42.0` -> `5.42.1`](https://renovatebot.com/diffs/npm/@typescript-eslint%2fparser/5.42.0/5.42.1) |

---

### Release Notes

<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/eslint-plugin)</summary>

### [`v5.42.1`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#&#8203;5421-httpsgithubcomtypescript-eslinttypescript-eslintcomparev5420v5421-2022-11-07)

[Compare Source](typescript-eslint/typescript-eslint@v5.42.0...v5.42.1)

##### Bug Fixes

-   **eslint-plugin:** isTypeReadonly stack overflow ([#&#8203;5875](typescript-eslint/typescript-eslint#5875)) ([#&#8203;5876](typescript-eslint/typescript-eslint#5876)) ([2d9a33c](typescript-eslint/typescript-eslint@2d9a33c))

</details>

<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/parser)</summary>

### [`v5.42.1`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#&#8203;5421-httpsgithubcomtypescript-eslinttypescript-eslintcomparev5420v5421-2022-11-07)

[Compare Source](typescript-eslint/typescript-eslint@v5.42.0...v5.42.1)

**Note:** Version bump only for package [@&#8203;typescript-eslint/parser](https://github.com/typescript-eslint/parser)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4yMC4wIiwidXBkYXRlZEluVmVyIjoiMzQuMjEuNCJ9-->

Co-authored-by: cabr2-bot <cabr2.help@gmail.com>
Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1631
Reviewed-by: Epsilon_02 <epsilon_02@noreply.codeberg.org>
Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this issue Nov 15, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint) | devDependencies | minor | [`5.42.1` -> `5.43.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/5.42.1/5.43.0) |
| [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint) | devDependencies | minor | [`5.42.1` -> `5.43.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2fparser/5.42.1/5.43.0) |

---

### Release Notes

<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/eslint-plugin)</summary>

### [`v5.43.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#&#8203;5430-httpsgithubcomtypescript-eslinttypescript-eslintcomparev5421v5430-2022-11-14)

[Compare Source](typescript-eslint/typescript-eslint@v5.42.1...v5.43.0)

##### Bug Fixes

-   **eslint-plugin:** \[no-shadow] handle false positives on generics and parameters ([#&#8203;5902](typescript-eslint/typescript-eslint#5902)) ([769e8c8](typescript-eslint/typescript-eslint@769e8c8))
-   **eslint-plugin:** \[promise-function-async] handle keyword token ([#&#8203;5907](typescript-eslint/typescript-eslint#5907)) ([f25a94f](typescript-eslint/typescript-eslint@f25a94f))

##### Features

-   **eslint-plugin:** \[consistent-type-imports] support fixing to inline types ([#&#8203;5050](typescript-eslint/typescript-eslint#5050)) ([75dcdf1](typescript-eslint/typescript-eslint@75dcdf1))
-   **eslint-plugin:** \[naming-convention] add support for "override" and "async" modifiers ([#&#8203;5310](typescript-eslint/typescript-eslint#5310)) ([#&#8203;5610](typescript-eslint/typescript-eslint#5610)) ([c759da1](typescript-eslint/typescript-eslint@c759da1))
-   **eslint-plugin:** \[prefer-optional-chain] support suggesting `!foo || !foo.bar` as a valid match for the rule ([#&#8203;5594](typescript-eslint/typescript-eslint#5594)) ([923d486](typescript-eslint/typescript-eslint@923d486))

#### [5.42.1](typescript-eslint/typescript-eslint@v5.42.0...v5.42.1) (2022-11-07)

##### Bug Fixes

-   **eslint-plugin:** isTypeReadonly stack overflow ([#&#8203;5875](typescript-eslint/typescript-eslint#5875)) ([#&#8203;5876](typescript-eslint/typescript-eslint#5876)) ([2d9a33c](typescript-eslint/typescript-eslint@2d9a33c))

</details>

<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/parser)</summary>

### [`v5.43.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#&#8203;5430-httpsgithubcomtypescript-eslinttypescript-eslintcomparev5421v5430-2022-11-14)

[Compare Source](typescript-eslint/typescript-eslint@v5.42.1...v5.43.0)

**Note:** Version bump only for package [@&#8203;typescript-eslint/parser](https://github.com/typescript-eslint/parser)

#### [5.42.1](typescript-eslint/typescript-eslint@v5.42.0...v5.42.1) (2022-11-07)

**Note:** Version bump only for package [@&#8203;typescript-eslint/parser](https://github.com/typescript-eslint/parser)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4yNC4wIiwidXBkYXRlZEluVmVyIjoiMzQuMjQuMSJ9-->

Co-authored-by: cabr2-bot <cabr2.help@gmail.com>
Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1639
Reviewed-by: Epsilon_02 <epsilon_02@noreply.codeberg.org>
Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
2 participants