function getPropTypesFromTypeAnnotation(node){var properties;switch(node.typeAnnotation.type){case'GenericTypeAnnotation':var annotation=resolveGenericTypeAnnotation(node.typeAnnotation);if(annotation&&annotation.id){annotation=findVariableByName(annotation.id.name);}properties=annotation?annotation.properties||[]:[];break;case'UnionTypeAnnotation':var union=resolveUnionTypeAnnotation(node.typeAnnotation);properties=union.reduce(function(acc,curr){if(!curr){return acc;}return acc.concat(curr.properties);},[]);break;case'ObjectTypeAnnotation':properties=node.typeAnnotation.properties;break;default:properties=[];break;}var props=properties.filter(function(property){return property.type==='ObjectTypeProperty';});return props.map(function(property){// the `key` property is not present in ObjectTypeProperty nodes, so we need to get the key name manually.
var tokens=context.getFirstTokens(property,1);var name=tokens[0].value;return{name:name,isRequired:!property.optional,node:property};});}
Extracts a PropType from a TypeAnnotation node.
@param   {ASTNode} node TypeAnnotation node.
@returns {Object[]}     Array of PropType object representations, to be consumed by `addPropTypesToComponent`.