UNPKG

@ts-ast-parser/core

Version:

Reflects a simplified version of the TypeScript AST for generating documentation

75 lines 2.18 kB
import type { ProjectContext } from '../project-context.js'; import type { ReflectedNode } from '../reflected-node.js'; import type { Decorator } from '../models/decorator.js'; import { CommentNode } from './comment-node.js'; import ts from 'typescript'; /** * Represents the reflected node of a decorator call */ export declare class DecoratorNode implements ReflectedNode<Decorator, ts.Decorator> { private readonly _decorator; private readonly _context; private readonly _jsDoc; constructor(decorator: ts.Decorator, context: ProjectContext); /** * The name of the decorator * * @returns The name of the decorator */ getName(): string; /** * The internal TypeScript node * * @returns The TypeScript AST node related to this reflected node */ getTSNode(): ts.Decorator; /** * 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 * * @returns The analyser context */ getContext(): ProjectContext; /** * The reflected documentation comment * * @returns The JSDoc node */ getJSDoc(): CommentNode; /** * If there are arguments supplied * * @returns True if there are arguments, otherwise false */ hasArguments(): boolean; /** * The values of the arguments supplied in the call * * @returns An array with the argument expression values */ getArguments(): unknown[]; /** * The line number where the decorator * is defined (not where it's used) * * @returns The start line position */ getLine(): number | null; /** * The source file path where the decorator * is defined (not where it's used) * * @returns The relative source file path where the declaration is defined */ getPath(): string; /** * Serializes the reflected node * * @returns The reflected node as a serializable object */ serialize(): Decorator; } //# sourceMappingURL=decorator-node.d.ts.map