Skip to content

functional/prefer-readonly-type false positive on tuple types #385

@maxpatiiuk

Description

@maxpatiiuk

Bug Report

Given the following code, ESLint reports functional/prefer-readonly-type rule:

type A = Readonly<[string]>;

Expected behavior

No error should be reported as the non-readonly tuple is never actually created since it is immediately being cast into a readonly tuple.

Actual behavior

Autofix replaces the above with:

type A = Readonly<readonly [string]>;

Proposed changes

Don't report the rule in this case, or disable auto fix, or remove Readonly<> when adding readonly

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions