As discussed in #650 and #2368, in Deno window === globalThis. This can be verified by running the statement in the REPL.
However, if you create a file...
// test.ts
console.log(window === globalThis);
and run deno test.ts, the tsc will throw an error, complaining that:
error TS2367: This condition will always return 'false' since the types 'typeof globalThis' and 'Window' have no overlap.
This also prevents the ability to use things like globalThis.fetch, globalThis.addEventListener, and globalThis.onload in .ts files, even though this should be perfectly safe in Deno given that all these things work in ordinary .js files and the REPL.
Debug Info
Tested on Deno v0.12.0 running on Windows 10
TypeScript: "It's not a bug, it's a feature" 馃槀
@justjavac thanks for the posting the related issue. Looks like the workaround for now is an // @ts-ignore comment. It'd be nice if this could be solved by an adjustment to the runtime's tsconfig.json but I don't know TS well enough to know if that's even possible.
@dev-nicolaos However in TS v3.5 window is still declared as declare var window: Window; not as Window & typeof globalThis as described in globalThis's PR. Maybe, the TS team will plans to change it.
Most helpful comment
TypeScript: "It's not a bug, it's a feature" 馃槀