Skip to content

[prefer-readonly-parameter-types] IndexSignature internals don't violate the rule #3714

Closed
@RebeccaStevens

Description

@RebeccaStevens

I wasn't sure if this was intentional behavior or not so I thought I may as well open an issue on it.

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro

{
  "rules": {
    "@typescript-eslint/prefer-readonly-parameter-type": "error"
  }
}
type Foo = {
  readonly [key: string]: {
    groups: string[];
  };
};

function foo(arg: Foo) {}

Expected Result

The PropertySignature in the IndexSignature is not readonly and thus the rule should be violated.

Actual Result

No rule violation.

Versions

package version
@typescript-eslint/eslint-plugin 4.29.0
@typescript-eslint/parser 4.29.0
TypeScript 4.3.5
ESLint 7.27.0
node 16.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions