normalizeClassDefinition.d.ts 694 B

12345678910111213141516171819202122
  1. import type { NodePath } from '@babel/traverse';
  2. import 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. */
  22. export default function normalizeClassDefinition(classDefinition: NodePath<ClassDeclaration | ClassExpression>): void;