in src/utils/getPropType.ts [189:233]
value: printValue(argumentPath),
};
}
const simplePropTypes = [
'array',
'bool',
'func',
'number',
'object',
'string',
'any',
'element',
'node',
'symbol',
'elementType',
] as const;
const propTypes = new Map<
string,
(path: NodePath, importer: Importer) => PropTypeDescriptor
>([
['oneOf', getPropTypeOneOf],
['oneOfType', getPropTypeOneOfType],
['instanceOf', getPropTypeInstanceOf],
['arrayOf', getPropTypeArrayOf],
['objectOf', getPropTypeObjectOf],
['shape', getPropTypeShapish.bind(null, 'shape')],
['exact', getPropTypeShapish.bind(null, 'exact')],
]);
/**
* Tries to identify the prop type by inspecting the path for known
* prop type names. This method doesn't check whether the found type is actually
* from React.PropTypes. It simply assumes that a match has the same meaning
* as the React.PropTypes one.
*
* If there is no match, "custom" is returned.
*/
export default function getPropType(
path: NodePath,
importer: Importer,
): PropTypeDescriptor {
let descriptor: PropTypeDescriptor | null = null;
getMembers(path, true).some(member => {