Title: Provide a way to augment global interfaces from external modules · Issue #4166 · microsoft/TypeScript · GitHub
Open Graph Title: Provide a way to augment global interfaces from external modules · Issue #4166 · microsoft/TypeScript
X Title: Provide a way to augment global interfaces from external modules · Issue #4166 · microsoft/TypeScript
Description: We get "bug reports" of this nature very often: I wrote this code interface Window { myPlugin: any; } let x = window.myPlugin; class Foo { } then I added 'export' and I get compile errors, wat? interface Window { myPlugin: any; } let x =...
Open Graph Description: We get "bug reports" of this nature very often: I wrote this code interface Window { myPlugin: any; } let x = window.myPlugin; class Foo { } then I added 'export' and I get compile errors, wat? int...
X Description: We get "bug reports" of this nature very often: I wrote this code interface Window { myPlugin: any; } let x = window.myPlugin; class Foo { } then I added 'export' and I get compil...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/4166
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Provide a way to augment global interfaces from external modules","articleBody":"We get \"bug reports\" of this nature very often:\n\n> I wrote this code\n> \n> ``` ts\n> interface Window {\n> myPlugin: any;\n> }\n> let x = window.myPlugin;\n> class Foo { }\n> ```\n> \n> then I added 'export' and I get compile errors, wat?\n> \n> ``` ts\n> interface Window {\n> myPlugin: any;\n> }\n> let x = window.myPlugin;\n> export class Foo { }\n> ```\n\nOur current answer today is \"Move your stuff to another .d.ts file\". This is an OK workaround, but not great. The real sticker is when there's a type defined inside an external module -- it's impossible to use those types to augment a global interface, even though this is a thing that actually happens. It gets even trickier because this encourages people to move types _into_ the global namespace when they didn't want to in the first place, exacerbating the problem.\n\nWe need some proposal for how to make this work.\n","author":{"url":"https://github.com/RyanCavanaugh","@type":"Person","name":"RyanCavanaugh"},"datePublished":"2015-08-05T16:17:40Z","url":"https://github.com/microsoft/TypeScript/issues/4166"}
| 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:aec7e27f-c220-401c-0f4e-0919d4159a5d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 919A:CC1A4:B8548C:EBBCD3:6B00F91D |
| html-safe-nonce | 4323a89015f6d2c2f7209aaaebc2df59adb950b8bdc2f3579050e900b4271aba |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MTlBOkNDMUE0OkI4NTQ4QzpFQkJDRDM6NkIwMEY5MUQiLCJ2aXNpdG9yX2lkIjoiODgwMDA3NTQ2MzcwODk2NTE0OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c6157d89796474c8ed8e4918093227aa4a37c01303368033b86a3e213fd675f9 |
| hovercard-subject-tag | issue:99242237 |
| 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/4166/issue_layout |
| twitter:image | https://opengraph.githubassets.com/778b37aff84ab5e6a3fbdc22a78484c3bf25193dd87d335c387f273761d8b877/microsoft/TypeScript/issues/4166 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/778b37aff84ab5e6a3fbdc22a78484c3bf25193dd87d335c387f273761d8b877/microsoft/TypeScript/issues/4166 |
| og:image:alt | We get "bug reports" of this nature very often: I wrote this code interface Window { myPlugin: any; } let x = window.myPlugin; class Foo { } then I added 'export' and I get compile errors, wat? int... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | RyanCavanaugh |
| 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 | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width