Skip to content

Bug: [prefer-readonly-parameter-types] Date param requires readonly how? #5087

Closed
@imcotton

Description

@imcotton

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.6.4&sourceType=module&code=PQgEB4CcFMDNpgOwMbVAGwJYCMC8AiaAZwCYAGARgFZ9RgA+AKGcegA8AHAe0gBdRkXREX6IArgFsA+ry5SRkTIgDmoXKAAUiAFyhxE7AgCUa+noB0sgMq9FKjUebtufAUJGgAJgENe0GXISRGqanroAIr7QJrhmnuYAbt7oYtAA8rAOjEA&rules=N4IgAgLgngDgpgZwMYCcCWMIFpEBs0B2EA9DCnAGZwpbkCGAJgPYG5RYx0p0C2cE1LNHgIQALhDUUTFCAC+QA&tsConfig=N4XyA

Repro Code

/// <reference lib="es2015" />



export const num_to_string = (n: number) => n.toString()

export const date_to_ms = (d: Date) => d.valueOf()

ESLint Config

module.exports = {
  "parser": "@typescript-eslint/parser",
  "rules": {
    "@typescript-eslint/prefer-readonly-parameter-types": "error"
  }
}

tsconfig

{
  "compilerOptions": {}
}

Expected Result

No complain with builtin Date type.

Actual Result

Parameter should be a read only type.

Additional Info

No response

Versions

package version
@typescript-eslint/eslint-plugin 5.26.0
@typescript-eslint/parser 5.26.0
TypeScript 4.6.4
ESLint 8.15.0
node web

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: eslint-pluginIssues related to @typescript-eslint/eslint-pluginworking as intendedIssues that are closed as they are working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions