sicua
Version:
A tool for analyzing project structure and dependencies
39 lines (38 loc) • 1.42 kB
TypeScript
import ts from "typescript";
/**
* Utility functions for finding and analyzing nodes in the TypeScript AST
*/
export declare class NodeUtils {
/**
* Finds a component node in the source file by name
*/
static findComponentNode(node: ts.Node, componentName: string, typeChecker: ts.TypeChecker): ts.Node | undefined;
/**
* Extracts state names from an array binding pattern (useState)
*/
static extractStateNames(declaration: ts.VariableDeclaration): [string, string];
/**
* Determines the scope of a node (render, effect, event, or other)
*/
static determineScope(node: ts.Node): "render" | "effect" | "event" | "other";
/**
* Finds import statements in a source file
*/
static findImports(sourceFile: ts.SourceFile): string[];
/**
* Finds a conditional expression for a JSX render
*/
static findRenderCondition(node: ts.Node): ts.Expression | undefined;
/**
* Finds error states referenced in a condition
*/
static findRelatedErrorStates(condition: ts.Expression | undefined, errorStates: Map<string, any>): string[];
/**
* Checks if a try-catch block contains fallback rendering
*/
static detectFallbackRender(catchClause: ts.CatchClause): boolean;
/**
* Checks if a catch clause contains error logging
*/
static hasErrorLogging(catchClause: ts.CatchClause): boolean;
}