-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[prefer-readonly-parameter-types] Proposal: Add type allowlist #4185
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
Comments
Copying my comment here for additional context: We can create an allowlist of types that are problematic and expand on them as required.
For example here is some code we could generalise from an existing rule: typescript-eslint/packages/eslint-plugin/src/rules/no-implied-eval.ts Lines 83 to 91 in 71c9370
|
As far as the subtype goes, I would allow that as well - e.g. const x = {a: readonly number; b: {c: readonly string; d: HTMLElement;}; } would pass (the rule would only skip |
Hi, |
Just thought I'd document this somewhere (the important parts should probably be added to the docs). type-fest's
|
Fixed in #4436, due to be released in 6.0. |
This propsal is a continuation of the discussion in #4061, cc @bradzacher
The rule
prefer-readonly-parameter-types
is known to not play nicely with certain types, with the canonical example being theHTMLElement
from the standard lib. This type cannot be made deep-readonly, as that breaks TS compilation altogether.Outstanding questions
The text was updated successfully, but these errors were encountered: