UNPKG

react-docgen

Version:

A library to extract information from React components for documentation generation.

13 lines (12 loc) 316 B
export default function getTypeIdentifier(path) { if (path.has('id')) { return path.get('id'); } else if (path.isTSTypeReference()) { return path.get('typeName'); } else if (path.isTSExpressionWithTypeArguments()) { return path.get('expression'); } return null; }