CodeQL documentation

Use of incompletely initialized object

ID: js/incomplete-object-initialization
Kind: problem
Security severity: 
Severity: error
Precision: high
   - correctness
   - language-features
Query suites:
   - javascript-security-and-quality.qls

Click to see the query in the CodeQL repository

If a class extends another class, its constructor needs to call the super constructor before referencing this or accessing properties through super. Failure to do so will cause a runtime error.


Insert a super constructor call.


In the following example, class A extends class B, but its constructor assigns to this.x without first invoking the super constructor, which will cause a runtime error.

class A extends B {
  constructor() { this.x = 42; }

To prevent the error, a super constructor call should be inserted:

class A extends B {
  constructor() { super(); this.x = 42; }


  • © GitHub, Inc.
  • Terms
  • Privacy