{"action":"created","issue":{"url":"https://api.github.com/repos/styleguidist/react-docgen-typescript/issues/151","repository_url":"https://api.github.com/repos/styleguidist/react-docgen-typescript","labels_url":"https://api.github.com/repos/styleguidist/react-docgen-typescript/issues/151/labels{/name}","comments_url":"https://api.github.com/repos/styleguidist/react-docgen-typescript/issues/151/comments","events_url":"https://api.github.com/repos/styleguidist/react-docgen-typescript/issues/151/events","html_url":"https://github.com/styleguidist/react-docgen-typescript/issues/151","id":379934927,"node_id":"MDU6SXNzdWUzNzk5MzQ5Mjc=","number":151,"title":"feature request: add first class support for filtering HTMLAttributes","user":{"login":"cdaringe","id":1003261,"node_id":"MDQ6VXNlcjEwMDMyNjE=","avatar_url":"https://avatars0.githubusercontent.com/u/1003261?v=4","gravatar_id":"","url":"https://api.github.com/users/cdaringe","html_url":"https://github.com/cdaringe","followers_url":"https://api.github.com/users/cdaringe/followers","following_url":"https://api.github.com/users/cdaringe/following{/other_user}","gists_url":"https://api.github.com/users/cdaringe/gists{/gist_id}","starred_url":"https://api.github.com/users/cdaringe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdaringe/subscriptions","organizations_url":"https://api.github.com/users/cdaringe/orgs","repos_url":"https://api.github.com/users/cdaringe/repos","events_url":"https://api.github.com/users/cdaringe/events{/privacy}","received_events_url":"https://api.github.com/users/cdaringe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-12T20:13:33Z","updated_at":"2018-11-12T20:17:56Z","closed_at":null,"author_association":"NONE","body":"# problem\r\n\r\noften times, one defines an a prop interface by extending  HTML attributes, e.g `React.ReactNode<HTMLInputAttributes>`.\r\n\r\ne.g.\r\n\r\n```tsx\r\ninterface MyProps extends React.ReactNode<HTMLInputAttributes> {\r\n  /** a really great prop */\r\n  bestProp: string\r\n}\r\n```\r\n\r\nconsequently, the styleguidist prop types generates prop documentation for _all_ of the HTML attributes, not simply `bestProp`.\r\n\r\n# discussion\r\n\r\n- first, thanks for this great lib\r\n- second, because this pattern is so common in react, it may be worth considering adding first class support for _omitting_ HTML attributes from the generated definitions.\r\n\r\nthoughts?  thanks!"},"comment":{"url":"https://api.github.com/repos/styleguidist/react-docgen-typescript/issues/comments/438014905","html_url":"https://github.com/styleguidist/react-docgen-typescript/issues/151#issuecomment-438014905","issue_url":"https://api.github.com/repos/styleguidist/react-docgen-typescript/issues/151","id":438014905,"node_id":"MDEyOklzc3VlQ29tbWVudDQzODAxNDkwNQ==","user":{"login":"swashcap","id":1858316,"node_id":"MDQ6VXNlcjE4NTgzMTY=","avatar_url":"https://avatars1.githubusercontent.com/u/1858316?v=4","gravatar_id":"","url":"https://api.github.com/users/swashcap","html_url":"https://github.com/swashcap","followers_url":"https://api.github.com/users/swashcap/followers","following_url":"https://api.github.com/users/swashcap/following{/other_user}","gists_url":"https://api.github.com/users/swashcap/gists{/gist_id}","starred_url":"https://api.github.com/users/swashcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swashcap/subscriptions","organizations_url":"https://api.github.com/users/swashcap/orgs","repos_url":"https://api.github.com/users/swashcap/repos","events_url":"https://api.github.com/users/swashcap/events{/privacy}","received_events_url":"https://api.github.com/users/swashcap/received_events","type":"User","site_admin":false},"created_at":"2018-11-12T20:17:55Z","updated_at":"2018-11-12T20:17:55Z","author_association":"NONE","body":"Looking at the `parserOptions.propFilter`, it looks like the first arg, [`PropItem`](https://github.com/styleguidist/react-docgen-typescript/blob/727fa6635eac4cc0a0ffe9df5abe70277f72f6e1/src/parser.ts#L25-L32) has a parent property which points to the source file:\r\n\r\n```js\r\n// styleguide.config.js\r\n// ...\r\nmodule.exports = {\r\n  propsParser: reactDocgenTypescript.withCustomConfig('./tsconfig.json', {\r\n    propFilter(prop, component) {\r\n      debugger\r\n      return true\r\n    }\r\n  }).parse,\r\n  // ...\r\n}\r\n```\r\n\r\nWhen debugging, it looks like `prop.parent` points to the source definition file:\r\n\r\n```shell\r\n> prop.parent\r\n{ fileName: 'baby-registry-components/node_modules/@types/react/index.d.ts',\r\n  name: 'HTMLAttributes' }\r\n```\r\n\r\nOne could use that to conditionally return based on the definition file's path.\r\n\r\n"}}
{"actor":{"display_login":"swashcap"}}