/** * React Component Detection Utilities * Provides AST-based detection of React components and their properties * * ## Migration: TypeScript Compiler API → tree-sitter * * ### Capability regressions (documented per Spec 08 plan Step 2.5): * * | Check | TS API approach | tree-sitter approach | Honest outcome | * |--------------------------|-------------------------------------|-----------------------------------|----------------| * | Prop type from interface | `checker.getTypeAtLocation()` | Parse type annotation as string | Recovers for inline types; loses cross-file interface resolution | * | `PropTypes.oneOf` | Type string from checker | Match call pattern textually | Full parity — doesn't need checker | * | Symbol resolution | `checker.getSymbolAtLocation()` | Not possible without checker | Lost — falls through to parameter destructuring heuristics | */ import type { ASTNode } from '../languages/types.js'; import { ComponentMetadata, ComponentImport, HookUsage, PropDefinition } from '../types.js'; /** * Check if a node is any type of React component */ export declare function isReactComponent(node: ASTNode): boolean; /** * Check if a node is a functional React component */ export declare function isFunctionalComponent(node: ASTNode): boolean; /** * Check if a node returns JSX elements */ export declare function returnsJSX(node: ASTNode): boolean; /** * Check if a node is a class component extending React.Component */ export declare function isClassComponent(node: ASTNode): boolean; /** * Extract hooks usage from a component node */ export declare function extractHooks(node: ASTNode): HookUsage[]; /** * Extract prop types from a component (TypeScript interfaces/types) * * NOTE: Cross-file interface resolution via TypeChecker is NOT available * with tree-sitter. We recover inline types and parameter destructuring, * but type references (e.g. `React.FC`) without inline definition * will fall through to parameter heuristics. */ export declare function extractPropTypes(node: ASTNode): PropDefinition[]; /** * Extract component imports from an AST. */ export declare function extractComponentImports(astRoot: ASTNode): ComponentImport[]; /** * Detect the specific type of component (functional, class, memo, forwardRef) */ export declare function detectComponentType(node: ASTNode): ComponentMetadata['componentType'] | null; /** * Get component name from various declaration patterns */ export declare function getComponentName(node: ASTNode): string; //# sourceMappingURL=reactDetection.d.ts.map