Skip to content
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

[Feature request] prefer-readonly-array #67

Open
SevenOutman opened this issue Oct 30, 2023 · 0 comments
Open

[Feature request] prefer-readonly-array #67

SevenOutman opened this issue Oct 30, 2023 · 0 comments

Comments

@SevenOutman
Copy link

SevenOutman commented Oct 30, 2023

Enforces an array argument of a function to be declared as readonly if it's never mutated in the function body.

function getValues(
  items: { value: number }[]  // Should be readonly!
) {
  return items.map(item => item.value)
}

Rationale: https://x.com/leishenghao/status/1664067474097332224?s=46&t=A5GTMNUCLTkLO8tQ8jEQJA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant