Disable no-magic-numbers
for typed variables
#9071
Closed
hmaesta
started this conversation in
Technical Discussions
Replies: 1 comment
-
As per our contributing guide (which is listed in the template and you deleted) we do not use discussions for support or questions. Please read through the guide for alternatives. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
My
@typescript-eslint/no-magic-numbers
configuration allowsignoreNumericLiteralTypes
, so I can create a type like the below without errors:Still, when using this type in a variable or a Map, for instance, I get "No magic number". If the variable is typed and its value is one of the expected literals, why would that be a magical number?
Some examples that return "No magic number":
🔗 Playground link
Is there any way to prevent "No magic number" for typed variables?
Beta Was this translation helpful? Give feedback.
All reactions