Why is the context
in the example below not accessible as window.context
?
The get_context
function works fine, but the context
variable does not. Why is that?
It's important to note that this is in a Deno TypeScript setting.
declare global {
let context: number
function get_context(): number
}
console.log(get_context()) // works
console.log(window.get_context()) // works
window.get_context = () => 1 // works
console.log(context) // works
console.log(window.context) // Error
window.context = 2 // Error
export {}