Title: Feature Request: Add labels to tuple elements · Issue #28259 · microsoft/TypeScript · GitHub
Open Graph Title: Feature Request: Add labels to tuple elements · Issue #28259 · microsoft/TypeScript
X Title: Feature Request: Add labels to tuple elements · Issue #28259 · microsoft/TypeScript
Description: Search Terms tuple type elements members labels names naming Suggestion Currently tuple types are defined like so: // length, count type Segment = [number, number]; I often find myself having to add labels to the elements of the tuple as...
Open Graph Description: Search Terms tuple type elements members labels names naming Suggestion Currently tuple types are defined like so: // length, count type Segment = [number, number]; I often find myself having to ad...
X Description: Search Terms tuple type elements members labels names naming Suggestion Currently tuple types are defined like so: // length, count type Segment = [number, number]; I often find myself having to ad...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/28259
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Feature Request: Add labels to tuple elements","articleBody":"## Search Terms\r\n\r\ntuple type elements members labels names naming\r\n\r\n## Suggestion\r\n\r\nCurrently tuple types are defined like so:\r\n\r\n```js\r\n// length, count\r\ntype Segment = [number, number];\r\n```\r\nI often find myself having to add labels to the elements of the tuple as a comment b/c the types themselves (number, string) don't adequately describe what the elements represent.\r\n\r\nIt would be nice if we could add labels to tuple elements using syntax similar to function parameters like so:\r\n\r\n```js\r\ntype Segment = [length: number, count: number];\r\n```\r\n\r\n## Use Cases\r\n\r\nCurrently we use comments to describe tuples, but adding this information directly to the AST can provide additional information for tooling.\r\n\r\n## Examples\r\n\r\nThis new syntax would also be useful in return types:\r\n```js\r\nfunction createSegment(/* ... */): [length: number, count: number] {\r\n /* ... */\r\n}\r\n```\r\n## Checklist\r\n\r\nMy suggestion meets these guidelines:\r\n* [x] This wouldn't be a breaking change in existing TypeScript / JavaScript code\r\n* [x] This wouldn't change the runtime behavior of existing JavaScript code\r\n* [x] This could be implemented without emitting different JS based on the types of the expressions\r\n* [x] This isn't a runtime feature (e.g. new expression-level syntax)\r\n\r\n","author":{"url":"https://github.com/brainkim","@type":"Person","name":"brainkim"},"datePublished":"2018-10-31T18:48:21Z","url":"https://github.com/microsoft/TypeScript/issues/28259"}
| 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:a29414e4-25c1-317b-997f-d919f1fd2bda |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 82FA:34CAB:57BED4:717B5F:6B00DD4B |
| html-safe-nonce | e6b56414e4279782b523ea75fb2fd664c1d5bdc5ddeb171d73ab53790d67f21d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MkZBOjM0Q0FCOjU3QkVENDo3MTdCNUY6NkIwMERENEIiLCJ2aXNpdG9yX2lkIjoiOTEzNTA1NjcyNjM4MTM1NDMxNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ea26ddd1c0cdac20a39ab033fe86d00c8c730cfa8a122e9b259384dc2218f284 |
| hovercard-subject-tag | issue:376110576 |
| 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/28259/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c79601cae70143584f684065cd7c4d467617427b707895d0c98608055306f249/microsoft/TypeScript/issues/28259 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c79601cae70143584f684065cd7c4d467617427b707895d0c98608055306f249/microsoft/TypeScript/issues/28259 |
| og:image:alt | Search Terms tuple type elements members labels names naming Suggestion Currently tuple types are defined like so: // length, count type Segment = [number, number]; I often find myself having to ad... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | brainkim |
| hostname | github.com |
| expected-hostname | github.com |
| None | 043c3f30fbcbe2c6c8e729e10cbbbc90c406546f9fbbb67c648d38f6b7d16daf |
| 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 | 5425dc24e8bd8d6fca9641a12afc984825a43875 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width