-
Notifications
You must be signed in to change notification settings - Fork 12.8k
"Self" variable assumes window environment at the top level #3238
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
Comments
You could in theory customize our |
I wanted |
looks like what you want is to explicitly reference |
also to add more context, we did split the lib into multiple smaller files(e.g. core, dom, webworkers, wscript, ...etc.), but we are still looking into easier ways to surface this change. it is on the list of work items for 2.0 (see roadmap). |
Got it - thanks for clarifying. As per your comment in #2953, I think eventually a |
Looks like there is no further information needed at this point. closing. |
I'm using Typescript to write a content script for a Firefox extension. These run in a special environment in which a number of variables are pre-defined,
self
being one of them. I can usedeclare var content;
, etc. to access them in TypeScript easily.However, they do not run in the window environment (at least not directly), so
window
may not be defined, andself
does not refer to window.self. Yet, when I dodeclare var self;
, I get the following error:So far, I haven't been able to find a way to convince
tsc
thatself
is actually a different type. This surprised me, because as far as I know, Typescript is not specific to the browser context. Should there be a flag to specify the runtime environment (or absence of one)?The text was updated successfully, but these errors were encountered: