You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/** * typescript says `[ts] Property 'x' does not exist on type 'Window'.` * for all of these, but they all exist and work in browsers: */window.Documentwindow.eval// <- this one is useful for "indirect eval" - i ran into this bug once earlierwindow.EventTargetwindow.Functionwindow.MouseEventwindow.HTMLElementwindow.DocumentFragment/** * same thing here, this is more similar to what i was doing when i found this bug */variframe=document.createElement("iframe");iframe.contentWindow.Document// etc etc// somewhat important note: there are probably more, i just quickly came up with these/** * they work in typescript if accessed this way: */DocumentevalEventTargetFunctionMouseEventHTMLElementDocumentFragment
there should be no errors, all the properties should exist on window
Actual behavior:
the properties don't exist on window but seem to exist in a "global scope" somehow so they're only visible to typescript when accessed directly
normally i guess i could just not use the window. prefix for accessing these properties, but that's not an option for indirect eval via window.eval or accessing the properties from other windows (iframes, window.opener, window.top, etc)
The text was updated successfully, but these errors were encountered:
Unfortunately it's a result of these types being separate to the global scope in TypeScript. You might be interested in a related issue that could improve the situation: #14052. For now, all the definitions would need to be duplicated into window (and global in node).
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
TypeScript Version: 2.1.1
Code
(you can paste it in the typescript playground here: https://www.typescriptlang.org/play/)
Expected behavior:
there should be no errors, all the properties should exist on
window
Actual behavior:
the properties don't exist on
window
but seem to exist in a "global scope" somehow so they're only visible to typescript when accessed directlynormally i guess i could just not use the
window.
prefix for accessing these properties, but that's not an option for indirect eval viawindow.eval
or accessing the properties from other windows (iframes,window.opener
,window.top
, etc)The text was updated successfully, but these errors were encountered: