Title: [Suggestion] Display the name of type alias in quick-info consistently · Issue #13095 · microsoft/TypeScript · GitHub
Open Graph Title: [Suggestion] Display the name of type alias in quick-info consistently · Issue #13095 · microsoft/TypeScript
X Title: [Suggestion] Display the name of type alias in quick-info consistently · Issue #13095 · microsoft/TypeScript
Description: I have tried my best to search existing issues. Pardon me if it is still duplicated. Currently quick-info will always display the name of an interface no matter if it is imported from other modules or declared in the same file. This grea...
Open Graph Description: I have tried my best to search existing issues. Pardon me if it is still duplicated. Currently quick-info will always display the name of an interface no matter if it is imported from other modules...
X Description: I have tried my best to search existing issues. Pardon me if it is still duplicated. Currently quick-info will always display the name of an interface no matter if it is imported from other modules...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/13095
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Suggestion] Display the name of type alias in quick-info consistently","articleBody":"I have tried my best to search existing issues. Pardon me if it is still duplicated.\r\n\r\nCurrently quick-info will always display the name of an `interface` no matter if it is imported from other modules or declared in the same file. This greatly shortens quick-info message length. \r\n\r\nType alias behaves partly like `interface`: if type alias is declared in a non-module file, quick-info displays its alias name. \r\n```ts\r\ntype Alias\u003cK> = {\r\n property1: K\r\n} | {\r\n property2: number\r\n}\r\n\r\nvar a: Alias\u003cstring> // popup as Alias\u003cstring>\r\n```\r\n[Online example](http://www.typescriptlang.org/play/#src=type%20Alias%3CK%3E%20%3D%20%7B%0A%20%20property1%3A%20K%0A%7D%20%7C%20%7B%0A%20%20property2%3A%20number%0A%7D%0A%0Avar%20a%3A%20Alias%3Cstring%3E)\r\n\r\nHowever, an `import` statement will make type alias displayed as its type literal expansion. \r\n\r\n```ts\r\nimport 'test'\r\ntype Alias\u003cK> = {\r\n property1: K\r\n} | {\r\n property2: number\r\n}\r\n\r\nvar a: Alias\u003cstring> // displayed as `{property1: string}|{property2: number}`\r\n```\r\n[example](http://www.typescriptlang.org/play/#src=import%20%27test%27%0Atype%20Alias%3CK%3E%20%3D%20%7B%0A%20%20property1%3A%20K%0A%7D%20%7C%20%7B%0A%20%20property2%3A%20number%0A%7D%0A%0Avar%20a%3A%20Alias%3Cstring%3E)\r\n\r\nWhen used with mapped types, type alias' full expansion soon becomes very lengthy. For my extreme case, one type can have 7500+ lines of code after expansion. \r\n\r\nAfter mapped types have more adoption, displaying type alias, in my speculation, might be a real world usability issue. It might even strangulate language service if the type is too large to show. For example, https://github.com/Microsoft/TypeScript/issues/12904 is using mapped type for MongoDB API. While all the typing looks proper and valid to me, the quick-info for `MongoFilter\u003cPerson>` is quite daunting. Also, compiler error reports the alias name, not expansion.\r\n\r\nIt would be fine if TypeScript can show alias name in quick-info consistently and concisely.","author":{"url":"https://github.com/HerringtonDarkholme","@type":"Person","name":"HerringtonDarkholme"},"datePublished":"2016-12-21T15:15:24Z","url":"https://github.com/microsoft/TypeScript/issues/13095"}
| 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:8a005448-c1c9-7013-fd8d-891f647af09c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 87A8:19B6A2:F9A382:14A445D:6B01D9C8 |
| html-safe-nonce | 5d7ce57f885fd747fd241c53d066b8a1ecf12ba4a46ec49b1549949acaf7ad83 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4N0E4OjE5QjZBMjpGOUEzODI6MTRBNDQ1RDo2QjAxRDlDOCIsInZpc2l0b3JfaWQiOiIzODE5NjIwNjY3MDI5MDUxODQ4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 4a5ed11995a92d79649ea1b0dd7d13b0dfb2601679566ce337c96c5798b82893 |
| hovercard-subject-tag | issue:196957075 |
| 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/13095/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e7f8da323fb3bd5a637ebbe7c42c05f2c1d0eee89d9ed38941f02bdddf4ea7a3/microsoft/TypeScript/issues/13095 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e7f8da323fb3bd5a637ebbe7c42c05f2c1d0eee89d9ed38941f02bdddf4ea7a3/microsoft/TypeScript/issues/13095 |
| og:image:alt | I have tried my best to search existing issues. Pardon me if it is still duplicated. Currently quick-info will always display the name of an interface no matter if it is imported from other modules... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | HerringtonDarkholme |
| 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