-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Report errors for duplicate case clauses #854
Labels
Comments
I don't think we can ever assume exhaustiveness in enums -- flags enums, for example, still have a valid |
Good point, amending the suggestion. |
This can be covered by flagging unreachable code. possibly part of #274 |
I'd prefer this to be part of #274, too, rather than a separate feature. |
danquirk
added
Duplicate
An existing issue was already created
and removed
In Discussion
Not yet reached consensus
labels
Apr 21, 2015
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
It is incredibly easy to make a copy/paste error for
case
clauses in aswitch
statement.While it is easily arguable that non-exhaustive cases can be allowed in TypeScript, there is no reason not to report duplicated cases.
"Obvious" semantics for
case
clauses in a singleswitch
statement are as follows:null
is handled more than once.undefined
is handled more than once.One interesting question is whether exhaustive cases for an enum should report an error when there is adefault
clause.The text was updated successfully, but these errors were encountered: