-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
When noImplicitThis
is turned on, you are unable to reference the global this
(which may be window, or global, or other value in various runtime environments).
I'm not sure if there is a recommended way around this, but currently there does not appear to be a way to get the "global" this
without an error 'this' implicitly has type 'any' because it does not have a type annotation.
This may be something I'm just not seeing. I tried to define global
but that wasn't much help.
TypeScript Version: 2.3.x
Code
(function (this: any, root) {
// do something isolated
})(<any>this);
Expected behavior:
Be able to use the global this
without error.
Actual behavior:
Compiler error 'this' implicitly has type 'any' because it does not have a type annotation.
when using this
globally.
cc @benlesh
Metadata
Metadata
Assignees
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript