in src/utils/getPropType.ts [139:180]
function getPropTypeShapish(
name: 'shape' | 'exact',
argumentPath: NodePath,
importer: Importer,
) {
const type: PropTypeDescriptor = { name };
if (!t.ObjectExpression.check(argumentPath.node)) {
argumentPath = resolveToValue(argumentPath, importer);
}
if (t.ObjectExpression.check(argumentPath.node)) {
const value = {};
argumentPath.get('properties').each(function (propertyPath) {
// @ts-ignore
if (propertyPath.get('type').value === t.SpreadElement.name) {
// It is impossible to resolve a name for a spread element
return;
}
const propertyName = getPropertyName(propertyPath, importer);
if (!propertyName) return;
const descriptor: PropDescriptor | PropTypeDescriptor = getPropType(
propertyPath.get('value'),
importer,
);
const docs = getDocblock(propertyPath);
if (docs) {
descriptor.description = docs;
}
descriptor.required = isRequiredPropType(propertyPath.get('value'));
value[propertyName] = descriptor;
});
type.value = value;
}
if (!type.value) {
type.value = printValue(argumentPath);
type.computed = true;
}
return type;
}