Description
Reflected node that represents a ClassDeclaration or a ClassExpression
Methods
-
getName
codeThe name of the class. If it’s a class expression that it’s assigned to a variable, it will return the name of the variable
getName(): string
Returns
string
:The name of the class
-
getNodeType
codeThe reflected node type
getNodeType(): RootNodeType
Returns
RootNodeType
:The declaration kind
-
getKind
codeThe reflected declaration kind
getKind(): DeclarationKind.Class
Returns
DeclarationKind.Class
:The class declaration kind
-
getContext
codeThe context includes useful APIs that are shared across all the reflected symbols. Some APIs include the parsed configuration options, the system interface, the type checker
getContext(): ProjectContext
Returns
ProjectContext
:The analyser context
-
getTSNode
codeThe internal TypeScript node
getTSNode(): ClassExpression | VariableStatement | ClassDeclaration
Returns
ClassExpression | VariableStatement | ClassDeclaration
:The TypeScript AST node related to this reflected node
-
getLine
codeThe start line number position
getLine(): number
Returns
number
:The start line number position
-
getNamespace
codeThe namespace where the class has been defined.
getNamespace(): string
Returns
string
:The name of the namespace where this declaration is defined. Will return an empty string if no namespace is found.
-
getJSDoc
codeThe reflected JSDoc comment node
getJSDoc(): CommentNode
Returns
CommentNode
:The JSDoc node
-
getDecorators
codeThe reflected decorators applied to the class
getDecorators(): DecoratorNode[]
Returns
DecoratorNode[]
:An array of reflected decorators
-
getDecoratorWithName
codeFinds a reflected decorator based on the name
getDecoratorWithName(name: string): DecoratorNode | null
Parameters
name string
The decorator name to find
Returns
DecoratorNode | null
:The reflected decorator that matches the given name
-
getConstructors
codeAn array of constructors that can be used to create an instance of the class
getConstructors(): SignatureNode[]
Returns
SignatureNode[]
:All the constructor signatures
-
getProperties
codeThe instance properties
getProperties(): PropertyNode[]
Returns
PropertyNode[]
:All the reflected instance properties
-
getStaticProperties
codeThe static properties
getStaticProperties(): PropertyNode[]
Returns
PropertyNode[]
:All the reflected static properties
-
getPropertyWithName
codeFinds an instance property based on the name
getPropertyWithName(name: string): PropertyNode | null
Parameters
name string
The property name to find
Returns
PropertyNode | null
:The reflected instance property that matches the given name
-
getMethods
codeThe instance methods
getMethods(): FunctionNode[]
Returns
FunctionNode[]
:All the reflected instance methods
-
getStaticMethods
codeThe static methods
getStaticMethods(): FunctionNode[]
Returns
FunctionNode[]
:All the reflected static methods
-
getMethodWithName
codeFinds an instance method based on the name
getMethodWithName(name: string): FunctionNode | null
Parameters
name string
The name of the method to find
Returns
FunctionNode | null
:The reflected instance method that matches the given name
-
getTypeParameters
codeThe type parameters
getTypeParameters(): TypeParameterNode[]
Returns
TypeParameterNode[]
:All the reflected type parameters
-
getHeritage
codeThe heritage chain. Interfaces that the class implements or parent classes that it extends.
getHeritage(): ExpressionWithTypeArgumentsNode[]
Returns
ExpressionWithTypeArgumentsNode[]
:The heritage chain
-
isCustomElement
codeWhether is a custom element or not
isCustomElement(): boolean
Returns
boolean
:True if the class declaration is a custom element, otherwise false
-
isAbstract
codeWhether it’s an abstract class or not
isAbstract(): boolean
Returns
boolean
:True if it’s an abstract class, otherwise false
-
serialize
codeSerializes the reflected node
serialize(): ClassDeclaration
Returns
ClassDeclaration
:The reflected node as a serializable object