Class MemberDeclaration
A member declaration in a class or interface, that is, either a method declaration or a field declaration.
Examples:
class Rectangle extends Shape {
width; // field declaration
height; // field declaration
constructor(height, width) { // constructor declaration, which is also a method declaration
this.height = height;
this.width = width;
}
area() { // method declaration
return this.width*this.height;
}
}
interface EventEmitter<T> {
addListener(listener: (x: T) => void): void; // method declaration
}
The subtype MemberSignature
contains TypeScript members that are abstract, ambient, or
overload signatures.
The subtype MemberDefinition
contains all members that are not signatures. In regular
JavaScript, all members are definitions.
There are also subtypes for working with specific kinds of members, such as FieldDeclaration
,
FieldSignature
, and FieldDefinition
, and similarly named subtypes for methods, constructors, and
getters and setters.
Import path
import javascript
Direct supertypes
Known direct subtypes
Predicates
getADecorator | Gets a decorator applied to this member. |
getAPrimaryQlClass | Gets the primary QL class for the Locatable. |
getDeclaringClass | Gets the class this member belongs to, if any. |
getDeclaringType | Gets the class or interface this member belongs to. |
getDecorator | Gets the |
getFirstControlFlowNode | Gets the first control flow node belonging to this syntactic entity. |
getInit | Gets the expression specifying the initial value of the member; for methods and constructors this is always a function, for fields it may not be defined. |
getMemberIndex | Gets the index of this member within its enclosing type. |
getName | Gets the name of this member. |
getNameExpr | Gets the expression specifying the name of this member, or nothing if this is a call signature. |
getStaticAsBool | Gets a boolean indicating if this member is static. |
hasImpureNameExpr | Holds if the name of this member is computed by an impure expression. |
hasPrivateFieldName | Holds if the member has a private name, such as |
hasPrivateKeyword | Holds if this is a TypeScript member annotated with the |
hasPublicKeyword | Holds if this is a TypeScript member explicitly annotated with the |
isAbstract | Holds if this member is abstract. |
isComputed | Holds if the name of this member is computed. |
isConcrete | True if this is neither abstract, ambient, nor part of an overloaded method signature. |
isPrivate | Holds if this member is considered private. |
isProtected | Holds if this is a TypeScript member annotated with the |
isPublic | Holds if this member is public, either because it has no access modifier or because it is explicitly annotated as |
isSignature | True if this is abstract, ambient, or an overload signature. |
isStatic | Holds if this member is static. |
toString | Gets a textual representation of this element. |
Inherited predicates
getAChild | Gets a child node of this node. | from AstNode |
getAChildExpr | Gets a child expression of this node. | from AstNode |
getAChildStmt | Gets a child statement of this node. | from AstNode |
getAToken | Gets a token belonging to this element. | from AstNode |
getChild | Gets the | from AstNode |
getChildExpr | Gets the | from AstNode |
getChildStmt | Gets the | from AstNode |
getChildTypeExpr | Gets the | from AstNode |
getContainer | Gets the function or toplevel to which this node belongs. | from NodeInStmtContainer |
getDocumentation | Gets the JSDoc comment for this element, if any. | from Documentable |
getEndLine | Gets the line on which this element ends. | from Locatable |
getFile | Gets the file this program element comes from. | from AstNode |
getFirstToken | Gets the first token belonging to this element. | from AstNode |
getLastToken | Gets the last token belonging to this element. | from AstNode |
getLocation | Gets this element’s location. | from Locatable |
getNumChild | Gets the number of child nodes of this node. | from AstNode |
getNumChildExpr | Gets the number of child expressions of this node. | from AstNode |
getNumChildStmt | Gets the number of child statements of this node. | from AstNode |
getNumLines | Gets the number of lines covered by this element. | from Locatable |
getParent | Gets the parent node of this node, if any. | from AstNode |
getPrimaryQlClasses | Gets a comma-separated list of the names of the primary CodeQL classes to which this element belongs. | from Locatable |
getStartLine | Gets the line on which this element starts. | from Locatable |
getTopLevel | Gets the toplevel syntactic unit to which this element belongs. | from AstNode |
inExternsFile | Holds if this syntactic entity belongs to an externs file. | from AstNode |
isAmbient | Holds if this is part of an ambient declaration or type annotation in a TypeScript file. | from AstNode |