{"action":"created","issue":{"url":"https://api.github.com/repos/reactjs/react-docgen/issues/33","repository_url":"https://api.github.com/repos/reactjs/react-docgen","labels_url":"https://api.github.com/repos/reactjs/react-docgen/issues/33/labels{/name}","comments_url":"https://api.github.com/repos/reactjs/react-docgen/issues/33/comments","events_url":"https://api.github.com/repos/reactjs/react-docgen/issues/33/events","html_url":"https://github.com/reactjs/react-docgen/issues/33","id":112252172,"node_id":"MDU6SXNzdWUxMTIyNTIxNzI=","number":33,"title":"Add support for imported propTypes","user":{"login":"echenley","id":6344219,"node_id":"MDQ6VXNlcjYzNDQyMTk=","avatar_url":"https://avatars0.githubusercontent.com/u/6344219?v=4","gravatar_id":"","url":"https://api.github.com/users/echenley","html_url":"https://github.com/echenley","followers_url":"https://api.github.com/users/echenley/followers","following_url":"https://api.github.com/users/echenley/following{/other_user}","gists_url":"https://api.github.com/users/echenley/gists{/gist_id}","starred_url":"https://api.github.com/users/echenley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/echenley/subscriptions","organizations_url":"https://api.github.com/users/echenley/orgs","repos_url":"https://api.github.com/users/echenley/repos","events_url":"https://api.github.com/users/echenley/events{/privacy}","received_events_url":"https://api.github.com/users/echenley/received_events","type":"User","site_admin":false},"labels":[{"id":181650510,"node_id":"MDU6TGFiZWwxODE2NTA1MTA=","url":"https://api.github.com/repos/reactjs/react-docgen/labels/help%20wanted","name":"help wanted","color":"159818","default":true},{"id":385982643,"node_id":"MDU6TGFiZWwzODU5ODI2NDM=","url":"https://api.github.com/repos/reactjs/react-docgen/labels/idea","name":"idea","color":"c5def5","default":false},{"id":423457912,"node_id":"MDU6TGFiZWw0MjM0NTc5MTI=","url":"https://api.github.com/repos/reactjs/react-docgen/labels/needs-discussion","name":"needs-discussion","color":"006b75","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":32,"created_at":"2015-10-19T23:17:07Z","updated_at":"2018-12-05T02:38:59Z","closed_at":null,"author_association":"NONE","body":"Importing prop types is a fairly common use case which doesn't appear to be possible at this stage. Any plans to support this pattern?\n\nExample:\n\n``` javascript\n// defaultPropTypes.js\n\nimport { PropTypes } from 'react';\n\nexport default {\n    prop1: PropTypes.string\n};\n```\n\n``` javascript\n// otherPropTypes.js\n\nimport { PropTypes } from 'react';\n\nexport default {\n    prop2: PropTypes.object\n};\n```\n\n``` javascript\n// MyComponent.jsx\n\nimport { Component } from 'react';\nimport defaultPropTypes from './defaultPropTypes.js';\nimport otherPropTypes './otherPropTypes.js';\n\nexport default class MyComponent extends Component {\n    static propTypes = {\n        ...defaultPropTypes,\n        ...otherPropTypes\n    }\n    // etc...\n}\n```\n\nResults in:\n\n``` json\n{\n  \"MyComponent.jsx\": {\n    \"description\": \"\"\n  }\n}\n```\n"},"comment":{"url":"https://api.github.com/repos/reactjs/react-docgen/issues/comments/444337243","html_url":"https://github.com/reactjs/react-docgen/issues/33#issuecomment-444337243","issue_url":"https://api.github.com/repos/reactjs/react-docgen/issues/33","id":444337243,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NDMzNzI0Mw==","user":{"login":"benjroy","id":1890801,"node_id":"MDQ6VXNlcjE4OTA4MDE=","avatar_url":"https://avatars3.githubusercontent.com/u/1890801?v=4","gravatar_id":"","url":"https://api.github.com/users/benjroy","html_url":"https://github.com/benjroy","followers_url":"https://api.github.com/users/benjroy/followers","following_url":"https://api.github.com/users/benjroy/following{/other_user}","gists_url":"https://api.github.com/users/benjroy/gists{/gist_id}","starred_url":"https://api.github.com/users/benjroy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benjroy/subscriptions","organizations_url":"https://api.github.com/users/benjroy/orgs","repos_url":"https://api.github.com/users/benjroy/repos","events_url":"https://api.github.com/users/benjroy/events{/privacy}","received_events_url":"https://api.github.com/users/benjroy/received_events","type":"User","site_admin":false},"created_at":"2018-12-05T02:38:59Z","updated_at":"2018-12-05T02:38:59Z","author_association":"NONE","body":"@pasupuletics and @siddharthkp got me inspired with their implementations.  I forked their repo and expanded the functionality, wrote a whole lot of snapshot tests, and in the end mostly tweaked some code related to `resolveToValue`.\r\n\r\nI'd like to offer this up in hopes that it will help others:  https://github.com/benjroy/react-docgen-imported-proptype-handler\r\n\r\n```\r\nnpm install react-docgen-imported-proptype-handler --save-dev\r\n```\r\n\r\nSetup is pretty much the same as `react-docgen-external-proptypes-handler`\r\n\r\nThe test fixtures exercise the expanded capabilities:  https://github.com/benjroy/react-docgen-imported-proptype-handler/tree/master/src/handlers/__tests__/fixtures/components\r\n\r\nAnd there is nothing computed in the final snapshot: https://github.com/benjroy/react-docgen-imported-proptype-handler/blob/master/src/handlers/__tests__/__snapshots__/importedPropTypeHandler-test.js.snap\r\n\r\nit works well following imports of files in your repo.\r\n\r\nfollowing imports from `node_modules`:  there is some basic path resolution and an implementation exercising it to make sure it won't throw, but I didn't write any logic to be able to read babel processed files from external dependencies"}}
{"actor":{"display_login":"benjroy"}}