Title: Aliases are lost when conditionals are applied · Issue #61581 · microsoft/TypeScript · GitHub
Open Graph Title: Aliases are lost when conditionals are applied · Issue #61581 · microsoft/TypeScript
X Title: Aliases are lost when conditionals are applied · Issue #61581 · microsoft/TypeScript
Description: 🔎 Search Terms aliases lost 🕗 Version & Regression Information Discussion with Mateusz Burzyński (@Andarist): TypeFormatFlags.InTypeAlias is at fault here, it's rather hard to track its exact conceptual purpose. And it has been there for...
Open Graph Description: 🔎 Search Terms aliases lost 🕗 Version & Regression Information Discussion with Mateusz Burzyński (@Andarist): TypeFormatFlags.InTypeAlias is at fault here, it's rather hard to track its exact conce...
X Description: 🔎 Search Terms aliases lost 🕗 Version & Regression Information Discussion with Mateusz Burzyński (@Andarist): TypeFormatFlags.InTypeAlias is at fault here, it's rather hard to track its exa...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/61581
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Aliases are lost when conditionals are applied","articleBody":"### 🔎 Search Terms\n\naliases lost\n\n### 🕗 Version & Regression Information\n\nDiscussion with @Andarist:\n\n- TypeFormatFlags.InTypeAlias is at fault here, it's rather hard to track its exact conceptual purpose. And it has been there forever - I found commits with it from 9 years ago\n- I briefly thought this might be related to ur issue: https://github.com/microsoft/TypeScript/issues/43031\nbut now I'm pretty sure it isn't\n- but it's also a somewhat funny issue because it complains about an alias for a union being lost and it was broken by a PR that... introduces improved union/intersection aliasing 😄 https://github.com/microsoft/TypeScript/pull/42149 , there was also a quick follow up to this PR that feels slightly related: https://github.com/microsoft/TypeScript/pull/42284\n\nAnyway, I'm sort of leaving breadcrumbs for myself - sorry for oversharing 😉 I'll dig further later\n\n### ⏯ Playground Link\n\nhttps://www.typescriptlang.org/play/?#code/C4TwDgpgBAShDOBXANsAPAQQDRQKID4oBeKAbwCgoqoAnCAQwBMB7AO2RCgH1h6BzAFxQARAHkA1sMrU6TNhygA3eskQQhGcgF8oAHzLSqslu049+Q4QDF6AS2RTqtBiYUQaNZjSG5t5cowQAMbI9HRQQWzwwFC28HBIqEIAFIhCiKzirMwA7qwAlMSEiLHwsAgo6PSsIDjVIPj+kazRUABmrMRQmDgEybasYEIJlT14hPrRNAN8hUSEcSOo-YOFAPyxg1CWzJJAA\n\n### 💻 Code\n\n```ts\ntype Result\u003cA, E> = {\n readonly _tag: \"Ok\"\n readonly value: A\n} | {\n readonly _tag: \"Fail\"\n readonly error: E\n}\n\ndeclare const isResult: (u: unknown) => u is Result\u003cany, any>\n\nconst fn = \u003cA, E>(inp: Result\u003cA, E> | string) => isResult(inp) ? inp : \"ok\"\n```\n\n\n### 🙁 Actual behavior\n\n```ts\nconst fn: \u003cA, E>(inp: Result\u003cA, E> | string) => {\n readonly _tag: \"Ok\";\n readonly value: A;\n} | {\n readonly _tag: \"Fail\";\n readonly error: E;\n} | \"ok\"\n```\n\n### 🙂 Expected behavior\n\n```ts\nconst fn: \u003cA, E>(inp: Result\u003cA, E> | string) => Result\u003cA, E> | \"ok\"\n```\n\n### Additional information about the issue\n\n_No response_","author":{"url":"https://github.com/mikearnaldi","@type":"Person","name":"mikearnaldi"},"datePublished":"2025-04-15T09:42:31Z","url":"https://github.com/microsoft/TypeScript/issues/61581"}
| 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:796c7eeb-976f-ad26-6649-ad809ad957ad |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B542:BB75:7C2349:A3DCCD:6B01AE21 |
| html-safe-nonce | e8dc78ff2b112f3ed3ff401e533cd7d992bbafc493649aa46dd3545f55afbe0e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNTQyOkJCNzU6N0MyMzQ5OkEzRENDRDo2QjAxQUUyMSIsInZpc2l0b3JfaWQiOiI2NTk5NDQ1MzcwNjk3MjY0NjczIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 6725916e059bae6cbcccc1724079471ae2394938ebb1f780b28ac08609f0e00f |
| hovercard-subject-tag | issue:2995826887 |
| 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/61581/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f91ec21ef4f1927e535acfef2a04250f9b66a97f594befaea220dcf39946b44c/microsoft/TypeScript/issues/61581 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f91ec21ef4f1927e535acfef2a04250f9b66a97f594befaea220dcf39946b44c/microsoft/TypeScript/issues/61581 |
| og:image:alt | 🔎 Search Terms aliases lost 🕗 Version & Regression Information Discussion with Mateusz Burzyński (@Andarist): TypeFormatFlags.InTypeAlias is at fault here, it's rather hard to track its exact conce... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mikearnaldi |
| 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