TypeScript icon indicating copy to clipboard operation
TypeScript copied to clipboard

Don't report an error when accessing a name of a global block-scoped variable on `globalThis` outside of `noImplicitAny`

Open Andarist opened this issue 1 year ago • 2 comments

fixes https://github.com/microsoft/TypeScript/issues/58345

Andarist avatar Jun 24 '24 07:06 Andarist

Even though the bug is labelled Help Wanted, I didn't see a consensus on the change we should make here. So that's probably the first task.

Also, will this fix the bug for the person who filed it? I'm not sure whether restricting this change to noImplicitAny: false makes sense -- since it really is a circularity error. I personally think it should remain one, but you can make the case that removing it here is useful. (and in JS there is special-case code to ensure that this pattern does work).

sandersn avatar Jun 28 '24 14:06 sandersn

It’s not a circularity. Block-scoped top-level variables define global variables but not globalThis properties (this is different from var)

Andarist avatar Jun 28 '24 16:06 Andarist