Title: Union in template literal simplifying unexpectedly · Issue #58340 · microsoft/TypeScript · GitHub
Open Graph Title: Union in template literal simplifying unexpectedly · Issue #58340 · microsoft/TypeScript
X Title: Union in template literal simplifying unexpectedly · Issue #58340 · microsoft/TypeScript
Description: 🔎 Search Terms template literal union distributive conditional type 🕗 Version & Regression Information 5.4.5 and Nightly ⏯ Playground Link https://www.typescriptlang.org/play/?ts=5.4.5#code/C4TwDgpgBAYg9nAclAvFABgMwQEgN4DkAjAAwkFQA+UAFOv...
Open Graph Description: 🔎 Search Terms template literal union distributive conditional type 🕗 Version & Regression Information 5.4.5 and Nightly ⏯ Playground Link https://www.typescriptlang.org/play/?ts=5.4.5#code/C4TwDgp...
X Description: 🔎 Search Terms template literal union distributive conditional type 🕗 Version & Regression Information 5.4.5 and Nightly ⏯ Playground Link https://www.typescriptlang.org/play/?ts=5.4.5#code/C4T...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/58340
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Union in template literal simplifying unexpectedly","articleBody":"### 🔎 Search Terms\r\n\r\ntemplate literal union distributive conditional type\r\n\r\n### 🕗 Version & Regression Information\r\n\r\n5.4.5 and Nightly\r\n\r\n### ⏯ Playground Link\r\n\r\nhttps://www.typescriptlang.org/play/?ts=5.4.5#code/C4TwDgpgBAYg9nAclAvFABgMwQEgN4DkAjAAwkFQA+UAFOvgHYCuAtgEYQBOAvulAGRQ83AJS8A3ACgA9NKihIsBMjRZceenmbsuvAUO68ZciAA9IAY2AQAJqigAibHFIkHVDM-ybtHHn0FhXiA\r\n\r\n### 💻 Code\r\n\r\n```ts\r\ntype FooN = `foo${'100' | (`${number}` & {})}`;\r\n// type FooN = `foo${`${number}` & {}}`\r\n// expected = \"foo100\" | `foo${`${number}` & {}}`\r\n```\r\n\r\n\r\n### 🙁 Actual behavior\r\n\r\n`'100'` and `` `${number}` & {} `` are being simplified to `` `${number}` & {} ``. `FooN` does not have autocomplete for `'foo100'`\r\n\r\n### 🙂 Expected behavior\r\n\r\n`FooN` should be of type ``\"foo100\" | `foo${`${number}` & {}}`` and provide autocomplete for `foo100` while allowing `foo101` or any other number\r\n\r\n### Additional information about the issue\r\n\r\n_No response_","author":{"url":"https://github.com/rj-lee","@type":"Person","name":"rj-lee"},"datePublished":"2024-04-27T02:08:57Z","url":"https://github.com/microsoft/TypeScript/issues/58340"}
| 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:883c80b4-6e97-ce06-2459-ac1572edf153 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ED08:B1B84:2CB1CC:38CA23:6B010200 |
| html-safe-nonce | 48f03a03de490b5f11f648dcbc651a66026c7c0eed07c08a045722d4b458bed8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRDA4OkIxQjg0OjJDQjFDQzozOENBMjM6NkIwMTAyMDAiLCJ2aXNpdG9yX2lkIjoiMjc1NDcwMTk3NjE0MjQ4NDQ4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | a6060de6de6a51d67d5c6865df7bf78c25028169fba4a27e4caa2131bda68bd4 |
| hovercard-subject-tag | issue:2266713153 |
| 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/58340/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9997d3cb4475fb9c8564a2c621e6879fd4fea86b935a9776745f455a6d982eb1/microsoft/TypeScript/issues/58340 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9997d3cb4475fb9c8564a2c621e6879fd4fea86b935a9776745f455a6d982eb1/microsoft/TypeScript/issues/58340 |
| og:image:alt | 🔎 Search Terms template literal union distributive conditional type 🕗 Version & Regression Information 5.4.5 and Nightly ⏯ Playground Link https://www.typescriptlang.org/play/?ts=5.4.5#code/C4TwDgp... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rj-lee |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| 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 | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width