You can turn it off with the following compiler option:
-warn-this-within-closure=false

--
Josh Tynjala
Bowler Hat LLC <https://bowlerhat.dev>


On Tue, Dec 3, 2019 at 9:36 AM Harbs <[email protected]> wrote:

> I recently started getting some of these warnings:
>
> Warning: Encountered this keyword within closure. Value of this will not
> be the same as enclosing scope.
>
> I understand the desire to have this warning, but I think it either needs
> to be smarter or be easily turned off.
>
> I have a case where I have Object.defineProperty which takes a function
> that needs to refer to “this”. That’s a valid use of this within a
> “closure”, and I can’t find an easy way of turning the warning off for that
> use case.
>
> Harbs

Reply via email to