Title: Report errors for duplicate case clauses · Issue #854 · microsoft/TypeScript · GitHub
Open Graph Title: Report errors for duplicate case clauses · Issue #854 · microsoft/TypeScript
X Title: Report errors for duplicate case clauses · Issue #854 · microsoft/TypeScript
Description: It is incredibly easy to make a copy/paste error for case clauses in a switch statement. switch (node.kind) { // ... case SyntaxKind.TupleType: // Do something with tuple types. case SyntaxKind.TupleType: // Do something with union types...
Open Graph Description: It is incredibly easy to make a copy/paste error for case clauses in a switch statement. switch (node.kind) { // ... case SyntaxKind.TupleType: // Do something with tuple types. case SyntaxKind.Tup...
X Description: It is incredibly easy to make a copy/paste error for case clauses in a switch statement. switch (node.kind) { // ... case SyntaxKind.TupleType: // Do something with tuple types. case SyntaxKind.Tup...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/854
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Report errors for duplicate case clauses","articleBody":"It is incredibly easy to make a copy/paste error for `case` clauses in a `switch` statement.\n\n``` TypeScript\nswitch (node.kind) {\n // ...\n case SyntaxKind.TupleType:\n // Do something with tuple types.\n case SyntaxKind.TupleType:\n // Do something with union types.\n // ...\n}\n```\n\nWhile it is easily arguable that non-exhaustive cases can be allowed in TypeScript, there is no reason not to report duplicated cases.\n\n\"Obvious\" semantics for `case` clauses in a single `switch` statement are as follows:\n- Report when named entities with identical symbols are handled.\n- Report when equal string literals are handled.\n- Report when equal numeric literals (even 0.0 and 0) are handled.\n- Report when `null` is handled more than once.\n- Report when `undefined` is handled more than once.\n\n---\n\n~~One interesting question is whether exhaustive cases for an enum should report an error when there is a `default` clause.~~\n","author":{"url":"https://github.com/DanielRosenwasser","@type":"Person","name":"DanielRosenwasser"},"datePublished":"2014-10-08T00:32:29Z","url":"https://github.com/microsoft/TypeScript/issues/854"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c5853282-53dd-99fd-f3fa-c78857091669 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C77A:80FB4:3FEA12:5A4C58:6B0072AF |
| html-safe-nonce | 7a3cd6ff54c4c42fdff9e73c9129960c866f1943de3336188cbf4982c574216e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNzdBOjgwRkI0OjNGRUExMjo1QTRDNTg6NkIwMDcyQUYiLCJ2aXNpdG9yX2lkIjoiMTY2NTk0MzI4NTM0NjEwMzk4MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 51378cf5a26a6d9cac889e752d4d16f57c30755315f7d1dbd1e0c177e71b34dc |
| hovercard-subject-tag | issue:45189560 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/854/issue_layout |
| twitter:image | https://opengraph.githubassets.com/141becc750c79ce173d304664c59d39466be848dce6ea55d596b3b04ebbee1fa/microsoft/TypeScript/issues/854 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/141becc750c79ce173d304664c59d39466be848dce6ea55d596b3b04ebbee1fa/microsoft/TypeScript/issues/854 |
| og:image:alt | It is incredibly easy to make a copy/paste error for case clauses in a switch statement. switch (node.kind) { // ... case SyntaxKind.TupleType: // Do something with tuple types. case SyntaxKind.Tup... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | DanielRosenwasser |
| hostname | github.com |
| expected-hostname | github.com |
| None | 75c2b65dd205f26961d0c29afed1a8d0bb7cca9f05780571dfd1ef93eb539d16 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 84e563eb4b55f8fa102f325f117533cee9e3df4a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width