UNPKG

694 BTypeScriptView Raw
1import type { NodePath } from '@babel/traverse';
2import type { ClassDeclaration, ClassExpression } from '@babel/types';
3/**
4 * Given a class definition (i.e. `class` declaration or expression), this
5 * function "normalizes" the definition, by looking for assignments of static
6 * properties and converting them to ClassProperties.
7 *
8 * Example:
9 *
10 * class MyComponent extends React.Component {
11 * // ...
12 * }
13 * MyComponent.propTypes = { ... };
14 *
15 * is converted to
16 *
17 * class MyComponent extends React.Component {
18 * // ...
19 * static propTypes = { ... };
20 * }
21 */
22export default function normalizeClassDefinition(classDefinition: NodePath<ClassDeclaration | ClassExpression>): void;