Title: Thoughts about variadic generics? · Issue #1773 · microsoft/TypeScript · GitHub
Open Graph Title: Thoughts about variadic generics? · Issue #1773 · microsoft/TypeScript
X Title: Thoughts about variadic generics? · Issue #1773 · microsoft/TypeScript
Description: We can kind of already do this for functions by defining several overloads, but there is no corresponding mechanism for overloaded classes or interfaces. A typical use case would be defining a registry for callbacks which accept a number...
Open Graph Description: We can kind of already do this for functions by defining several overloads, but there is no corresponding mechanism for overloaded classes or interfaces. A typical use case would be defining a regi...
X Description: We can kind of already do this for functions by defining several overloads, but there is no corresponding mechanism for overloaded classes or interfaces. A typical use case would be defining a regi...
Mail addresses
notifications@github.com
Opengraph URL: https://github.com/microsoft/TypeScript/issues/1773
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Thoughts about variadic generics?","articleBody":"We can kind of already do this for functions by defining several overloads, but there is no corresponding mechanism for overloaded classes or interfaces. A typical use case would be defining a registry for callbacks which accept a number of parameters. Something like the following with loosely proposed variadic type syntax:\n\n``` typescript\ninterface IDispatcher\u003c...ArgTypes> {\n\n add(callback: (...args: ArgTypes) => void): void {\n // store the callback\n }\n\n dispatch(...args: ArgTypes): void {\n // invoke the callbacks\n }\n}\n\n\nfunction createDispatcher\u003c...ArgTypes>(): IDispatcher\u003c...ArgTypes> {\n // create a concrete instance\n}\n\n\nvar d = createDispatcher\u003cnumber, string>();\n```\n","author":{"url":"https://github.com/sccolbert","@type":"Person","name":"sccolbert"},"datePublished":"2015-01-22T16:25:35Z","url":"https://github.com/microsoft/TypeScript/issues/1773"}
| 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:0f9801cd-13cc-cb8a-5f89-c26679fdbf81 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C8CE:65478:C9323A:10CC6B3:6B00F985 |
| html-safe-nonce | df4358d92256b9bc80e2b319dd37ff4f5bf7209556f78454d299efa6fd0f4444 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOENFOjY1NDc4OkM5MzIzQToxMENDNkIzOjZCMDBGOTg1IiwidmlzaXRvcl9pZCI6IjQzNDY3MjMzNDQ5MDYzMDUzMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ea9c2ab429fc47f097196d44d6d17a68e9ee08b04a87135aceb894350c6d1c27 |
| hovercard-subject-tag | issue:55174070 |
| 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/1773/issue_layout |
| twitter:image | https://opengraph.githubassets.com/da7e5a22415c5df55aff71fcdd49e790a4436d5ec97ab0344a35bca7fe5349a6/microsoft/TypeScript/issues/1773 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/da7e5a22415c5df55aff71fcdd49e790a4436d5ec97ab0344a35bca7fe5349a6/microsoft/TypeScript/issues/1773 |
| og:image:alt | We can kind of already do this for functions by defining several overloads, but there is no corresponding mechanism for overloaded classes or interfaces. A typical use case would be defining a regi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sccolbert |
| hostname | github.com |
| expected-hostname | github.com |
| None | e208d86428ec00a57ade75058166297440e8128a01e5287c31a53dc042bbf187 |
| 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 | 7dafd017fb7809a839c443dba08622af38e63c09 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width