diff --git a/README.md b/README.md index 59bf4a8d..09e8cd99 100644 --- a/README.md +++ b/README.md @@ -109,8 +109,12 @@ type PropFilter = (prop: PropItem, component: Component) => boolean; const options = { propFilter: (prop: PropItem, component: Component) => { - if (prop.parent) { - return !prop.parent.fileName.includes("node_modules"); + if (prop.declarations !== undefined && prop.declarations.length > 0) { + const hasPropAdditionalDescription = prop.declarations.find((declaration) => { + return !declaration.fileName.includes("node_modules"); + }); + + return Boolean(hasPropAdditionalDescription); } return true; diff --git a/src/__tests__/data/ButtonWithOnClickComponent.tsx b/src/__tests__/data/ButtonWithOnClickComponent.tsx new file mode 100644 index 00000000..32e636ca --- /dev/null +++ b/src/__tests__/data/ButtonWithOnClickComponent.tsx @@ -0,0 +1,14 @@ +import { FC, PropsWithRef } from 'react'; + +type HTMLButtonProps = JSX.IntrinsicElements['button']; + +type Props = HTMLButtonProps & { + /** onClick event handler */ + onClick?: HTMLButtonProps['onClick']; +}; + +const ButtonWithOnClickComponent: FC = props => { + return