Title: Access `global` as a type · Issue #14052 · microsoft/TypeScript · GitHub
Open Graph Title: Access `global` as a type · Issue #14052 · microsoft/TypeScript
X Title: Access `global` as a type · Issue #14052 · microsoft/TypeScript
Description: Since https://github.com/Microsoft/TypeScript/wiki/What's-new-in-TypeScript#augmenting-globalmodule-scope-from-modules it's been possible to augment the global from a module. However, in TypeScript definitions (such as dom.d.ts or node...
Open Graph Description: Since https://github.com/Microsoft/TypeScript/wiki/What's-new-in-TypeScript#augmenting-globalmodule-scope-from-modules it's been possible to augment the global from a module. However, in TypeScri...
X Description: Since https://github.com/Microsoft/TypeScript/wiki/What's-new-in-TypeScript#augmenting-globalmodule-scope-from-modules it's been possible to augment the global from a module. However, in Type...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/14052
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Access `global` as a type","articleBody":"Since https://github.com/Microsoft/TypeScript/wiki/What%27s-new-in-TypeScript#augmenting-globalmodule-scope-from-modules it's been possible to augment the `global` from a module. However, in TypeScript definitions (such as `dom.d.ts` or `node.d.ts`) we're left to create our own \"globals\". This results in two issue:\r\n\r\n1. inconsistency with what is _actually_ the global namespace\r\n2. requiring the declaration of global types multiple times in case it's used as a \"real global\" or from `window.` (browsers) or `global.` (node)\r\n\r\nInstead of this, it'd be really nice to access TypeScript's `global` as a type. For instance, in `dom.d.ts` we could do:\r\n\r\n```ts\r\ndeclare var window: global\r\n```\r\n\r\nOr in `node.d.ts`:\r\n\r\n```ts\r\ndeclare var global: global\r\n```\r\n\r\nI couldn't see any previous issues, but it's partially related to things like https://github.com/Microsoft/TypeScript/issues/12902 - the difference though is that those issues seems to be tracking adding variables to the TypeScript global scope whereas this would be using the global scope as a type to define these variables themselves.","author":{"url":"https://github.com/blakeembrey","@type":"Person","name":"blakeembrey"},"datePublished":"2017-02-13T23:35:50Z","url":"https://github.com/microsoft/TypeScript/issues/14052"}
| 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:401a31a4-0817-b40b-3855-f22ab54b75c7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D258:1201C:28418FB:357D65B:6B01AB5A |
| html-safe-nonce | 9cb470b59241cde9c941885f580b7132e7ee7fcdfa848d3b0faa82a9d61c37fe |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMjU4OjEyMDFDOjI4NDE4RkI6MzU3RDY1Qjo2QjAxQUI1QSIsInZpc2l0b3JfaWQiOiI0MzQ4MjcxNTkxNDQ1MDgwOTIyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 958559e5767793d5e91b57728a34a9ae2a9a207268c2bbb60c2666ff4ab4030a |
| hovercard-subject-tag | issue:207372917 |
| 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/14052/issue_layout |
| twitter:image | https://opengraph.githubassets.com/560a51e3ab8caedd3121e21ab35ebee2dc4bbcac0613eaed118c77d2344e4522/microsoft/TypeScript/issues/14052 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/560a51e3ab8caedd3121e21ab35ebee2dc4bbcac0613eaed118c77d2344e4522/microsoft/TypeScript/issues/14052 |
| og:image:alt | Since https://github.com/Microsoft/TypeScript/wiki/What's-new-in-TypeScript#augmenting-globalmodule-scope-from-modules it's been possible to augment the global from a module. However, in TypeScri... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | blakeembrey |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width