UNPKG

1.29 kBTypeScriptView Raw
1import type { NodePath } from '@babel/traverse';
2import type { CallExpression, ClassDeclaration, ClassExpression, ClassMethod, Expression, ObjectExpression, ObjectMethod, TaggedTemplateExpression, VariableDeclaration } from '@babel/types';
3import type { StatelessComponentNode } from '../resolver/index.js';
4type SupportedNodes = CallExpression | ClassDeclaration | ClassExpression | ObjectExpression | StatelessComponentNode | TaggedTemplateExpression | VariableDeclaration;
5export declare function isSupportedDefinitionType(path: NodePath): path is NodePath<SupportedNodes>;
6/**
7 * This is a helper method for handlers to make it easier to work either with
8 * an ObjectExpression from `React.createClass` class or with a class
9 * definition.
10 *
11 * Given a path and a name, this function will either return the path of the
12 * property value if the path is an ObjectExpression, or the value of the
13 * ClassProperty/MethodDefinition if it is a class definition (declaration or
14 * expression).
15 *
16 * It also normalizes the names so that e.g. `defaultProps` and
17 * `getDefaultProps` can be used interchangeably.
18 */
19export default function getMemberValuePath(componentDefinition: NodePath<SupportedNodes>, memberName: string): NodePath<ClassMethod | Expression | ObjectMethod> | null;
20export {};