Title: Inconsistent enum literal types · Issue #61196 · microsoft/TypeScript · GitHub
Open Graph Title: Inconsistent enum literal types · Issue #61196 · microsoft/TypeScript
X Title: Inconsistent enum literal types · Issue #61196 · microsoft/TypeScript
Description: 🔎 Search Terms return type inference enum union literal fresh regular 🕗 Version & Regression Information This is the behavior in every version I tried ⏯ Playground Link https://www.typescriptlang.org/play/?ts=5.8.0-dev.20250216#code/KYOw...
Open Graph Description: 🔎 Search Terms return type inference enum union literal fresh regular 🕗 Version & Regression Information This is the behavior in every version I tried ⏯ Playground Link https://www.typescriptlang.o...
X Description: 🔎 Search Terms return type inference enum union literal fresh regular 🕗 Version & Regression Information This is the behavior in every version I tried ⏯ Playground Link https://www.typescriptla...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/61196
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Inconsistent enum literal types","articleBody":"### 🔎 Search Terms\n\nreturn type inference enum union literal fresh regular\n\n### 🕗 Version & Regression Information\n\n- This is the behavior in every version I tried\n\n### ⏯ Playground Link\n\nhttps://www.typescriptlang.org/play/?ts=5.8.0-dev.20250216#code/KYOwrgtgBAolDeUCCAaKAhKBfAUDgLgJ4AOwGA9gB4A8AKgHxQC8COUUA5sPgFxQAUASmaNaAbjZQAztz78AbgEMANmGB9awpo3nkAlgBMJWCTgPAAxssUAnMgDMwIC-j3kQUAEZU69BSrUNQT50HwZTC3cpfC8QAEZmLyp+AAZBMSgAekyKGnAIT2AbehxIkGjYgCYQn3zC4sTvSlT0rJyAeQBrPDKKwoSWJv4YADokVuzc6hgS3pjC6qmZxuTR8YzJmBsbchs0JumxxhByGMUpKT0OEEVPZTJ8ciWSoA\n\n### 💻 Code\n\n```ts\nenum E { A, B }\n\ntype Box\u003cT> = {\n get: () => T;\n set: (value: T) => void;\n};\n\ndeclare function box\u003cT>(value: T): Box\u003cT>;\n\nconst bn1 = box(0); // Box\u003cnumber>\nconst bn2: Box\u003cnumber> = box(0); // Ok\n\nconst be1 = box(E.A); // Box\u003cE>\nconst be2: Box\u003cE> = box(E.A); // Error, box\u003cE.A> not assignable to Box\u003cE>\n```\n\n\n### 🙁 Actual behavior\n\n`be2` errors\n\n### 🙂 Expected behavior\n\n`be2` shouldn't error\n\n### Additional information about the issue\n\nThis is an enum-based variant of https://github.com/microsoft/TypeScript/issues/48363 . As such it relates to the open https://github.com/microsoft/TypeScript/issues/59754 too","author":{"url":"https://github.com/Andarist","@type":"Person","name":"Andarist"},"datePublished":"2025-02-16T20:17:20Z","url":"https://github.com/microsoft/TypeScript/issues/61196"}
| 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:4d2d76a4-05ae-3e0c-cdb1-468f34927f7b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B90E:1D86C4:2931DB1:34542F6:6B01A24C |
| html-safe-nonce | 4123cabf1073fe63cac24067eafbacffa3e947268cc99990da4775a23dd7166d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOTBFOjFEODZDNDoyOTMxREIxOjM0NTQyRjY6NkIwMUEyNEMiLCJ2aXNpdG9yX2lkIjoiMjY2Mzk3OTMyMjg0MjM5MTExNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 4e67cc8acf13466ee1e28145fd4e95d07603f303b9686b7b351893ec6f321e64 |
| hovercard-subject-tag | issue:2856309883 |
| 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/61196/issue_layout |
| twitter:image | https://opengraph.githubassets.com/eaa2cc373f7732dbaee37e62501eae8ab015b8bda5079d1585dcd975bccb8465/microsoft/TypeScript/issues/61196 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/eaa2cc373f7732dbaee37e62501eae8ab015b8bda5079d1585dcd975bccb8465/microsoft/TypeScript/issues/61196 |
| og:image:alt | 🔎 Search Terms return type inference enum union literal fresh regular 🕗 Version & Regression Information This is the behavior in every version I tried ⏯ Playground Link https://www.typescriptlang.o... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Andarist |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width