-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Ensure global type instances are available. #1175
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix ! Can you also add the test case I gave in the issue
d09539a
to
3d075cb
Compare
@ry done |
import { window } from "./globals"; | ||
import { globalEval } from "./global_eval"; | ||
|
||
const window = globalEval("this"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doing that won't cause window to miss all properties assigned to it in globals.ts
? I think we would like to use most of them in REPL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Valid question ... However, I'm going to land this anyway because I need the fix and because this is passing the tests. If this indeed breaks window
properties, we should add tests that nail that behavior down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't just rebased it against my REPL branch and everything works as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At compile/bundle time this ends up being an any
, even when you do import { window } from "./globals.ts";
(because that reference is the same globalEval("this");
. At runtime we build the type library which describes what the global scope is, and the ability to access the globalEval
module isn't possible. I had previously thought about tightening compile time typings of globalEval("this");
which could be done, but it would be difficult and not really provide any safety, as most of what we do with it is cast it to any
anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
- Update to TypeScript 3.1.6 (denoland#1177) - Fixes Headers type not available. (denoland#1175) - Reader/Writer to use Uint8Array not ArrayBufferView (denoland#1171) - Fixes importing modules starting with 'http'. (denoland#1167) - build: Use target/ instead of out/ (denoland#1153) - Support repl multiline input (denoland#1165)
Fixes #1173
It also cleans up a few things related to the
globals.ts
and provides more comments to help guide additions to the file.