diff --git a/src/hooks/useComponentDoc.js b/src/hooks/useComponentDoc.js index 0f26c373a..4b8bdb528 100644 --- a/src/hooks/useComponentDoc.js +++ b/src/hooks/useComponentDoc.js @@ -23,9 +23,11 @@ const getTypeDefs = (component) => { .map((key) => component[key]?.__docs__?.tags) .filter(Boolean); - const tagsFromPropTypes = Object.getOwnPropertyNames(component.propTypes).map( - (key) => component.propTypes[key]?.__docs__?.tags - ); + const tagsFromPropTypes = component.propTypes + ? Object.getOwnPropertyNames(component.propTypes).map( + (key) => component.propTypes[key]?.__docs__?.tags + ) + : []; const componentTypeDefNames = tagsFromComponentProperties .concat(tagsFromPropTypes)