Title: Need to support declaration merging in external modules · Issue #2821 · microsoft/TypeScript · GitHub
Open Graph Title: Need to support declaration merging in external modules · Issue #2821 · microsoft/TypeScript
X Title: Need to support declaration merging in external modules · Issue #2821 · microsoft/TypeScript
Description: jQuery (jQuery UI) support method extensions. If we write my own jQuery UI widget, I can do this: In myWidget.ts: interface JQuery { myWidget(): JQuery } class myWidget { public foo() { // This is okay now, but will fail once we add some...
Open Graph Description: jQuery (jQuery UI) support method extensions. If we write my own jQuery UI widget, I can do this: In myWidget.ts: interface JQuery { myWidget(): JQuery } class myWidget { public foo() { // This is ...
X Description: jQuery (jQuery UI) support method extensions. If we write my own jQuery UI widget, I can do this: In myWidget.ts: interface JQuery { myWidget(): JQuery } class myWidget { public foo() { // This is ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/2821
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Need to support declaration merging in external modules","articleBody":"jQuery (jQuery UI) support method extensions. If we write my own jQuery UI widget, I can do this:\nIn myWidget.ts:\n\n``` typescript\ninterface JQuery {\n myWidget(): JQuery\n}\n\nclass myWidget {\n public foo() {\n // This is okay now, but will fail once we add some import statements to this file,\n // because TypeScript thinks this JQuery is not that JQuery\n var some: JQuery = $(\"#some-id\").text();\n }\n}\n\n$.fn.extend({\n myWidget() {...}\n});\n```\n\nThen in another file:\n\n``` typescript\n$(selector).myWidget(); // Create a new myWidget, this is okay because of myWidget() is declared in my version of JQuery interface\n$(selector).attr(\"id\", \"my-id\"); // This is okay because attr is declared in jquery.d.ts\n```\n\nHowever, this stops working when I add this line to myWidget.ts:\n\n``` typescript\nimport helpers = require(\"helpers\");\n```\n\nNow TypeScript thinks there 2 JQuery interfaces, instead of merging them into one. How do I tell TypeScript that I'm not creating a new interface for this module, but need to merge it with an existing interface?\n","author":{"url":"https://github.com/cnshenj","@type":"Person","name":"cnshenj"},"datePublished":"2015-04-17T19:37:38Z","url":"https://github.com/microsoft/TypeScript/issues/2821"}
| 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:99a29724-ec29-5f20-acab-21b01c69439f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B340:3A4875:DAAB21:123D229:6B010275 |
| html-safe-nonce | d691806fc4021c3dcd0c3c2d35b8836aad6ac34d8963e8f2d349ce4a15e5a834 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMzQwOjNBNDg3NTpEQUFCMjE6MTIzRDIyOTo2QjAxMDI3NSIsInZpc2l0b3JfaWQiOiIxMDU4ODAxNTU4NzE3NzkyODg1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 4a52470a8b5cf42560c3304a3fcc2e42be0a22f02328d7ba8079aad5d99bca81 |
| hovercard-subject-tag | issue:69203632 |
| 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/2821/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7a7fc421f4e1330e46f44595f2f13d9a1b6e7519d3693b98e23bee10a5d84297/microsoft/TypeScript/issues/2821 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7a7fc421f4e1330e46f44595f2f13d9a1b6e7519d3693b98e23bee10a5d84297/microsoft/TypeScript/issues/2821 |
| og:image:alt | jQuery (jQuery UI) support method extensions. If we write my own jQuery UI widget, I can do this: In myWidget.ts: interface JQuery { myWidget(): JQuery } class myWidget { public foo() { // This is ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | cnshenj |
| 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