Title: Declaration merging in plain JS with JSDoc · Issue #57559 · microsoft/TypeScript · GitHub
Open Graph Title: Declaration merging in plain JS with JSDoc · Issue #57559 · microsoft/TypeScript
X Title: Declaration merging in plain JS with JSDoc · Issue #57559 · microsoft/TypeScript
Description: 🔍 Search Terms jsdoc declaration merging ✅ Viability Checklist This wouldn't be a breaking change in existing TypeScript/JavaScript code This wouldn't change the runtime behavior of existing JavaScript code This could be implemented with...
Open Graph Description: 🔍 Search Terms jsdoc declaration merging ✅ Viability Checklist This wouldn't be a breaking change in existing TypeScript/JavaScript code This wouldn't change the runtime behavior of existing JavaSc...
X Description: 🔍 Search Terms jsdoc declaration merging ✅ Viability Checklist This wouldn't be a breaking change in existing TypeScript/JavaScript code This wouldn't change the runtime behavior of existin...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/57559
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Declaration merging in plain JS with JSDoc","articleBody":"### 🔍 Search Terms\n\njsdoc declaration merging\n\n### ✅ Viability Checklist\n\n- [X] This wouldn't be a breaking change in existing TypeScript/JavaScript code\n- [X] This wouldn't change the runtime behavior of existing JavaScript code\n- [X] This could be implemented without emitting different JS based on the types of the expressions\n- [X] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)\n- [X] This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types\n- [X] This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals\n\n### ⭐ Suggestion\n\nAbility to merge declarations. \n\n### 📃 Motivating Example\n\nFor example, this is a declaration merge in TS:\r\n\r\n```ts\r\nexport const Foo = makeFooClass()\r\nexport type Foo = InstanceType\u003ctypeof Foo>\r\n```\r\n\r\nIn JS we can't do this. I was hoping for something similar to this to achieve the same:\r\n\r\n```js\r\nexport const Foo = makeFooClass() // returns a class\r\n/** @export {InstanceType\u003ctypeof Foo>} Foo */\r\n```\n\n### 💻 Use Cases\n\n1. What do you want to use this for? To merge declarations in certain cases.\r\n2. What shortcomings exist with current approaches? There's no way to do it AFAICT\r\n3. What workarounds are you using in the meantime? None\r\n","author":{"url":"https://github.com/trusktr","@type":"Person","name":"trusktr"},"datePublished":"2024-02-27T04:42:41Z","url":"https://github.com/microsoft/TypeScript/issues/57559"}
| 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:5093c86e-e0b3-53f8-19e0-4f298415f84b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9F48:11EACE:D4ADD8:11CAA5E:6B0100AF |
| html-safe-nonce | f61dbb213be59ec363c67b8d8b15857b6882782288452d39bae44711bafb16fb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RjQ4OjExRUFDRTpENEFERDg6MTFDQUE1RTo2QjAxMDBBRiIsInZpc2l0b3JfaWQiOiIyNDAzNjQ4NTIxNjY5NTA5Mjk1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | a4af180cafe1ce15c946d016e3f68b0854f48862ab745b9d3fe20912213fad6e |
| hovercard-subject-tag | issue:2155639513 |
| 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/57559/issue_layout |
| twitter:image | https://opengraph.githubassets.com/db6d23dd85ff2046f0cdcfa707a4878c04b8876a2a17230e36fbc41d19418bf8/microsoft/TypeScript/issues/57559 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/db6d23dd85ff2046f0cdcfa707a4878c04b8876a2a17230e36fbc41d19418bf8/microsoft/TypeScript/issues/57559 |
| og:image:alt | 🔍 Search Terms jsdoc declaration merging ✅ Viability Checklist This wouldn't be a breaking change in existing TypeScript/JavaScript code This wouldn't change the runtime behavior of existing JavaSc... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | trusktr |
| 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