Codiga has joined Datadog!

Read the Blog
Skip to main content

Class Definition AST JavaScript Object

The ClassDefinition object matches the definition of a class.

The astType value for this node is classdefinition.

Code Pattern

This AST element captures the arg1 or arg2 part of the following code:

class Rectangle {
constructor(height, width) {
this.height = height;
this.width = width;
}
}

Attributes

  • name (type AstString): name of the class
  • parentClass (type AstString): name of the parent class if any