-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[consistent-type-assertions] Disable check as const if assertionStyle: never #992
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
Is it a bug or need to add a new option to handle Right now the following code with the option const x = [1] as const; Is it the right behavior? Or need to ignore const assertion for option // @typescript-eslint/consistent-type-assertions": ["error", { "assertionStyle": "never" }]
const x = [1] as const;
const y = { a: 1 } as const; |
I'm still undecided tbh. I can see arguments going both directions, but I think this is probably safe to allow in the rule as a special case, considering it cannot ever weaken any typings. |
One problem is that with |
yeah. I really wish there was a compiler-level flag for disabling angle-bracket assertions... I mean there kind is (by renaming the file to I was thinking maybe we bring back the old rule, or maybe we add more options to this rule to make it more flexible. |
Please allow an option to specifically disable checks for |
Repro
Expected Result
No error
Actual Result
error Do not use any type assertions
Additional Info
Versions
@typescript-eslint/eslint-plugin
2.3.1
@typescript-eslint/parser
2.2
TypeScript
3.6
ESLint
6.3
node
12
npm
6
The text was updated successfully, but these errors were encountered: