Skip to content

Bug: [consistent-indexed-object-style] Fails on generic circular reference #5472

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
4 tasks done
JoshuaKGoldberg opened this issue Aug 13, 2022 · 0 comments · Fixed by #5746
Closed
4 tasks done

Bug: [consistent-indexed-object-style] Fails on generic circular reference #5472

JoshuaKGoldberg opened this issue Aug 13, 2022 · 0 comments · Fixed by #5746
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

@JoshuaKGoldberg
Copy link
Member

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.7.2&sourceType=module&code=KYDwDg9gTgLgBASwHY2FAZgQwMbDgGQQCMpMoBPOAbwCg44BtBALjgGcYpkBzAXVcIkylAD7tOPBrwDcNAL40aoSLEQo0WXAWKkKAcWBI0CbAB4AKgD5qdRi3FckfVubhjBu8gaNczV2Qo0QA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6MgeyeUuX0Ra1mAE0QAPRMNocARgCtEZOn0JJ0URNGgdokcGAC+IA0A&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA

Repro Code

export interface Library {
  [i: string]: Library | string[];
}

export interface LibraryGeneric<T> {
  [i: string]: T | LibraryGeneric<T>;
}

ESLint Config

module.exports = {
  "rules": {
    "@typescript-eslint/consistent-indexed-object-style": "error"
  }
}

tsconfig

{
  "compilerOptions": {
    "strictNullChecks": true
  }
}

Expected Result

interface LibraryGeneric can't be represented by a type for the same reason Library can't, per #4347. The rule shouldn't report on it.

Actual Result

The rule reports on LibraryGeneric.

Additional Info

Like #2687, but with generics.

Versions

package version
@typescript-eslint/eslint-plugin 5.33.0
@typescript-eslint/parser 5.33.0
TypeScript 4.7.2
ESLint 8.15.0
node web
@JoshuaKGoldberg JoshuaKGoldberg added bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for team members to take a look labels Aug 13, 2022
@bradzacher bradzacher added accepting prs Go ahead, send a pull request that resolves this issue and removed triage Waiting for team members to take a look labels Aug 13, 2022
JoshuaKGoldberg added a commit to yeonjuan/typescript-eslint that referenced this issue Oct 5, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 5, 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