Closed
Description
Now that globalThis is available, top-level this
also has a more precise type, and issues the normal noImplicitAny element access errors for unknown properties:
if (this['unknown']) { ... } // error, `typeof globalThis` has no index signature
if (this.unknown) { ... } // error, `typeof globalThis` has no index signature
this.onmousemove = function () { /* ok, and this: Window */ }
We have a conflict: traditionally, "x has no index signature" errors are produced when noImplicitAny is on. Also traditionally, "this has type any" errors are produced when noImplicitThis is on.
Technically, top-level this
no longer has type any, so it's technically correct to issue the errors from behind noImplicitAny. But people might expect to see them only when noImplicitThis is on instead.
Let's discuss at the next design meeting.