Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a declaration file containing all global references #9

Closed
bre1470 opened this issue Oct 3, 2018 · 0 comments
Closed

Create a declaration file containing all global references #9

bre1470 opened this issue Oct 3, 2018 · 0 comments
Assignees

Comments

@bre1470
Copy link
Contributor

bre1470 commented Oct 3, 2018

@weswigham:
So there's a bunch of ways to deal with that in modules w/o using a namespace, but I think the way that leaves the least undesirable types in a public namespace is to make a module like this:

// @filename: reexposedGlobals.d.ts
export type GlobalSVGElement = SVGElements;
And then add an import of that to the module which is going to shadow the global:

import {GlobalSVGElement as SVGDOMElement} from "./reeexposedGlobals";
Essentially, you use another real module as the scope you alias the globals in, instead of the scope outside a namespace.
We have plans in the future to make it possible to reference shadowed global in a less roundabout way similar to how import types let you dig into modules, but we're waiting on the escmascript globalThis proposal to finalize it's choice of identifier before we ship it.

@bre1470 bre1470 self-assigned this Oct 3, 2018
@bre1470 bre1470 closed this as completed Nov 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant