Skip to content

[prefer-readonly-parameter-types] false positive with tagged primitive type #1790

@ckknight

Description

@ckknight

Repro

{
  "rules": {
    "@typescript-eslint/prefer-readonly-parameter-types": "error"
  }
}
type MySpecialString = string & {
  readonly ' __tag': unique symbol;
};
function custom1(arg: MySpecialString) {}

// or

declare const specialTag: unique symbol;
type MyOtherSpecialString = string & {
  readonly [specialTag]: true;
}
function custom2(arg: MyOtherSpecialString) {}

Expected Result
No error

Actual Result
Parameter should be a read only type

Additional Info

Versions

package version
@typescript-eslint/eslint-plugin 2.25.0
@typescript-eslint/parser 2.25.0
TypeScript 3.8.3
ESLint 6.8.0
node 12.16.1
npm 6.13.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issueenhancementNew feature or requestpackage: 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