Inspectopedia Help

Potentially invalid reference to 'this' from closure

Reports a this in closure that is used for referencing properties of outer context.

Example:

function Outer() { this.outerProp = 1; function inner() { // bad, because 'outerProp' of Outer // won't be updated here // on calling 'new Outer()' as may be expected this.outerProp = 2; } inner(); }

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

JSPotentiallyInvalidUsageOfThis
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | JavaScript and TypeScript | Probable bugs

Last modified: 11 September 2024