Title: Allow augmenting the global scope with new names · Issue #7161 · microsoft/TypeScript · GitHub
Open Graph Title: Allow augmenting the global scope with new names · Issue #7161 · microsoft/TypeScript
X Title: Allow augmenting the global scope with new names · Issue #7161 · microsoft/TypeScript
Description: It would be great if TypeScript could model situations where new names are added to the global scope. This was described by a team member as a desirable feature that could definitely be enabled in #7015 (comment). However that issue is c...
Open Graph Description: It would be great if TypeScript could model situations where new names are added to the global scope. This was described by a team member as a desirable feature that could definitely be enabled in ...
X Description: It would be great if TypeScript could model situations where new names are added to the global scope. This was described by a team member as a desirable feature that could definitely be enabled in ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/7161
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Allow augmenting the global scope with new names","articleBody":"It would be great if TypeScript could model situations where new names are added to the global scope. \n\nThis was described by a team member as a desirable feature that could definitely be enabled in https://github.com/Microsoft/TypeScript/issues/7015#issuecomment-184943914. However that issue is closed, and I can't find any other open issue tracking the suggestion, so I opened this one.\n\nA basic example:\n\n``` typescript\n// File: foo.ts\n\n// Augment the global scope to add foo\ndeclare global {\n var foo: Function; // ERROR: Cannot introduce new top level names\n}\n\n// Implement foo\nvar fooImpl = () => {/***/};\nfoo = fooImpl; // OK - compiler 'sees' global foo here\nexport default fooImpl;\n\n// Reference foo\nfoo(); // OK - compiler 'sees' global foo here\n```\n\nCurrently this produces a compiler error as shown above. Interestingly, the global `foo` _is_ recognised at the two other sites where it is referenced in the example. So it appears this would already work just if the error message was suppressed.\n","author":{"url":"https://github.com/yortus","@type":"Person","name":"yortus"},"datePublished":"2016-02-20T05:10:02Z","url":"https://github.com/microsoft/TypeScript/issues/7161"}
| 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:ea986ad2-e6de-948a-525a-32889483562a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B62C:95C88:D302D1:1185D7F:6B00F944 |
| html-safe-nonce | 918e2e254470a71e747409c5da8af0aff0a37c0395e34ef1920573e739a089c4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNjJDOjk1Qzg4OkQzMDJEMToxMTg1RDdGOjZCMDBGOTQ0IiwidmlzaXRvcl9pZCI6Ijg2NDYxNjM0NjI3OTgwMzIwNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 75830ebbb13b9bc9ea9a9b76dbe0db8c10a5990df2e0a4aba0854d1229f18e09 |
| hovercard-subject-tag | issue:135034719 |
| 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/7161/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ad26ac75713a468eee030bf90d4b33faac877085205a602d9c04ccb3b51da91c/microsoft/TypeScript/issues/7161 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ad26ac75713a468eee030bf90d4b33faac877085205a602d9c04ccb3b51da91c/microsoft/TypeScript/issues/7161 |
| og:image:alt | It would be great if TypeScript could model situations where new names are added to the global scope. This was described by a team member as a desirable feature that could definitely be enabled in ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | yortus |
| 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