🚧 Still under progress. Soon will be finished.

ClassNode

CLASS code

Description

Reflected node that represents a ClassDeclaration or a ClassExpression

Methods

  • getName

    code

    The 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

    code

    The reflected node type

    getNodeType(): RootNodeType

    Returns

    RootNodeType:

    The declaration kind

  • getKind

    code

    The reflected declaration kind

    getKind(): DeclarationKind.Class

    Returns

    DeclarationKind.Class:

    The class declaration kind

  • getContext

    code

    The 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

    code

    The internal TypeScript node

    getTSNode(): ClassExpression | VariableStatement | ClassDeclaration

    Returns

    ClassExpression | VariableStatement | ClassDeclaration:

    The TypeScript AST node related to this reflected node

  • getLine

    code

    The start line number position

    getLine(): number

    Returns

    number:

    The start line number position

  • getNamespace

    code

    The 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

    code

    The reflected JSDoc comment node

    getJSDoc(): CommentNode

    Returns

    CommentNode:

    The JSDoc node

  • getDecorators

    code

    The reflected decorators applied to the class

    getDecorators(): DecoratorNode[]

    Returns

    DecoratorNode[]:

    An array of reflected decorators

  • getDecoratorWithName

    code

    Finds 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

    code

    An array of constructors that can be used to create an instance of the class

    getConstructors(): SignatureNode[]

    Returns

    SignatureNode[]:

    All the constructor signatures

  • getProperties

    code

    The instance properties

    getProperties(): PropertyNode[]

    Returns

    PropertyNode[]:

    All the reflected instance properties

  • getStaticProperties

    code

    The static properties

    getStaticProperties(): PropertyNode[]

    Returns

    PropertyNode[]:

    All the reflected static properties

  • getPropertyWithName

    code

    Finds 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

    code

    The instance methods

    getMethods(): FunctionNode[]

    Returns

    FunctionNode[]:

    All the reflected instance methods

  • getStaticMethods

    code

    The static methods

    getStaticMethods(): FunctionNode[]

    Returns

    FunctionNode[]:

    All the reflected static methods

  • getMethodWithName

    code

    Finds 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

    code

    The type parameters

    getTypeParameters(): TypeParameterNode[]

    Returns

    TypeParameterNode[]:

    All the reflected type parameters

  • getHeritage

    code

    The heritage chain. Interfaces that the class implements or parent classes that it extends.

    getHeritage(): ExpressionWithTypeArgumentsNode[]

    Returns

    ExpressionWithTypeArgumentsNode[]:

    The heritage chain

  • isCustomElement

    code

    Whether is a custom element or not

    isCustomElement(): boolean

    Returns

    boolean:

    True if the class declaration is a custom element, otherwise false

  • isAbstract

    code

    Whether it’s an abstract class or not

    isAbstract(): boolean

    Returns

    boolean:

    True if it’s an abstract class, otherwise false

  • serialize

    code

    Serializes the reflected node

    serialize(): ClassDeclaration

    Returns

    ClassDeclaration:

    The reflected node as a serializable object