Title: Strict Comparison Operator Doesn't Infer Singleton Types Correctly · Issue #6940 · microsoft/TypeScript · GitHub
Open Graph Title: Strict Comparison Operator Doesn't Infer Singleton Types Correctly · Issue #6940 · microsoft/TypeScript
X Title: Strict Comparison Operator Doesn't Infer Singleton Types Correctly · Issue #6940 · microsoft/TypeScript
Description: Having a singleton type type A = "a" | "b", a variable const a: A = "a", and an expression a === "c", the compiler should infer the type of "c" as A and make the expression unsound. Currently (1.8.0 and 1.9.0-dev.20160206) it compiles, w...
Open Graph Description: Having a singleton type type A = "a" | "b", a variable const a: A = "a", and an expression a === "c", the compiler should infer the type of "c" as A and make the expression unsound. Currently (1.8....
X Description: Having a singleton type type A = "a" | "b", a variable const a: A = "a", and an expression a === "c", the compiler should infer the type of "c" as ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/6940
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Strict Comparison Operator Doesn't Infer Singleton Types Correctly","articleBody":"Having a singleton type `type A = \"a\" | \"b\"`, a variable `const a: A = \"a\"`, and an expression `a === \"c\"`, the compiler should infer the type of `\"c\"` as `A` and make the expression unsound. \n\nCurrently (1.8.0 and 1.9.0-dev.20160206) it compiles, which makes usage of singleton types instead of enums less type safe.\n","author":{"url":"https://github.com/vlad-shatskyi","@type":"Person","name":"vlad-shatskyi"},"datePublished":"2016-02-06T13:50:37Z","url":"https://github.com/microsoft/TypeScript/issues/6940"}
| 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:20e22b90-baa8-3c53-4e3d-7f71041e2963 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C52E:170A63:4C8C4D:67C990:6AFBF0ED |
| html-safe-nonce | 9029b775437c9e8d6d5955c98f076cc1b5b0d906de5c21993db9c7d54c32620f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNTJFOjE3MEE2Mzo0QzhDNEQ6NjdDOTkwOjZBRkJGMEVEIiwidmlzaXRvcl9pZCI6Ijc4MDQ0MTUyOTQ3NDYzOTA3NjUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ffe1655b32e3686f6866b8a3632b71f97a198e15223f738198fdd9b481a42972 |
| hovercard-subject-tag | issue:131856768 |
| 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/6940/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cf566f9154f78c7f11f8210d1b963f296b82fdd6973ecf73c9bdb94917b5dea9/microsoft/TypeScript/issues/6940 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cf566f9154f78c7f11f8210d1b963f296b82fdd6973ecf73c9bdb94917b5dea9/microsoft/TypeScript/issues/6940 |
| og:image:alt | Having a singleton type type A = "a" | "b", a variable const a: A = "a", and an expression a === "c", the compiler should infer the type of "c" as A and make the expression unsound. Currently (1.8.... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vlad-shatskyi |
| hostname | github.com |
| expected-hostname | github.com |
| None | fa74413a1d84dac536fcca0740780bcbd3207bafec0e51873b73ff8e8cca032f |
| 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 | b3b5633a74535d9c23385512d534c66c8fde1907 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width