{"action":"created","comment":{"url":"https://api.github.com/repos/reactjs/react-docgen/pulls/comments/49613757","id":49613757,"diff_hunk":"@@ -233,8 +235,158 @@ The structure of the JSON blob / JavaScript object is as follows:\n - `<typeName>`: The name of the type, which is usually corresponds to the function name in `React.PropTypes`. However, for types define with `oneOf`, we use `\"enum\"`  and for `oneOfType` we use `\"union\"`. If a custom function is provided or the type cannot be resolved to anything of `React.PropTypes`, we use `\"custom\"`.\n - `<typeValue>`: Some types accept parameters which define the type in more detail (such as `arrayOf`, `instanceOf`, `oneOf`, etc). Those are stored in `<typeValue>`. The data type of `<typeValue>` depends on the type definition.\n \n+## Flow Type support\n+\n+If you are using [flow][flow] then react-docgen can also extract the flow type annotations. As flow has a way more advanced and fine granular type system, the returned types from react-docgen are different in comparison when using `React.PropTypes`.\n+\n+> **Note**: react-docgen will not be able to grab the type definition if the type is imported or declared in a different file.\n+\n+### Example\n+\n+For the following component\n+\n+```js\n+import React, { Component } from 'react';\n+\n+type Props = {\n+  /** Description of prop \"foo\". */\n+  primitive: number,\n+  /** Description of prop \"bar\". */\n+  literalsAndUnion: 'string' | 'otherstring' | number,\n+  arr: Array<any>,\n+  func?: (value: string) => void,\n+  obj?: { subvalue: ?boolean },\n+};\n+\n+/**\n+ * General component description.\n+ */\n+export default class MyComponent extends Component<void,Props,void> {\n+\n+  props: Props;\n+\n+  render(): ?ReactElement {\n+    // ...\n+  }\n+}\n+\n+```\n+\n+we are getting this output:\n+\n+```\n+{\n+  \"description\": \"General component description.\",\n+  \"props\": {\n+    \"primitive\": {\n+      \"type\": {\n+        \"name\": \"number\"\n+      },\n+      \"required\": true,\n+      \"description\": \"Description of prop \\\"foo\\\".\"\n+    },\n+    \"literalsAndUnion\": {\n+      \"type\": {\n+        \"name\": \"union\",\n+        \"raw\": \"'string' | 'otherstring' | number\",\n+        \"value\": [\n+          {\n+            \"name\": \"literal\",\n+            \"value\": \"string\"\n+          },\n+          {\n+            \"name\": \"literal\",\n+            \"value\": \"otherstring\"\n+          },\n+          {\n+            \"name\": \"number\"\n+          }\n+        ]\n+      },\n+      \"required\": true,\n+      \"description\": \"Description of prop \\\"bar\\\".\"\n+    },\n+    \"arr\": {\n+      \"type\": {\n+        \"name\": \"Array\",\n+        \"value\": [\n+          {\n+            \"name\": \"any\"\n+          }\n+        ],\n+        \"raw\": \"Array<any>\"\n+      },\n+      \"required\": true\n+    },\n+    \"func\": {\n+      \"type\": {\n+        \"name\": \"functionshape\",\n+        \"raw\": \"(value: string) => void\",\n+        \"value\": {\n+          \"value\": {\n+            \"name\": \"string\"\n+          },\n+          \"__return__\": {\n+            \"name\": \"void\"\n+          }\n+        }\n+      },\n+      \"required\": false\n+    },\n+    \"obj\": {\n+      \"type\": {\n+        \"name\": \"objectshape\",","path":"README.md","position":163,"original_position":163,"commit_id":"55293560ebd5dd44f5d9bef91f0b379d3edc2759","original_commit_id":"55293560ebd5dd44f5d9bef91f0b379d3edc2759","user":{"login":"danez","id":231804,"avatar_url":"https://avatars.githubusercontent.com/u/231804?v=3","gravatar_id":"","url":"https://api.github.com/users/danez","html_url":"https://github.com/danez","followers_url":"https://api.github.com/users/danez/followers","following_url":"https://api.github.com/users/danez/following{/other_user}","gists_url":"https://api.github.com/users/danez/gists{/gist_id}","starred_url":"https://api.github.com/users/danez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danez/subscriptions","organizations_url":"https://api.github.com/users/danez/orgs","repos_url":"https://api.github.com/users/danez/repos","events_url":"https://api.github.com/users/danez/events{/privacy}","received_events_url":"https://api.github.com/users/danez/received_events","type":"User","site_admin":false},"body":"Same here with the name. For propTypes this was just \"shape\"","created_at":"2016-01-13T16:32:58Z","updated_at":"2016-01-13T16:32:58Z","html_url":"https://github.com/reactjs/react-docgen/pull/48#discussion_r49613757","pull_request_url":"https://api.github.com/repos/reactjs/react-docgen/pulls/48","_links":{"self":{"href":"https://api.github.com/repos/reactjs/react-docgen/pulls/comments/49613757"},"html":{"href":"https://github.com/reactjs/react-docgen/pull/48#discussion_r49613757"},"pull_request":{"href":"https://api.github.com/repos/reactjs/react-docgen/pulls/48"}}},"pull_request":{"url":"https://api.github.com/repos/reactjs/react-docgen/pulls/48","id":55153935,"html_url":"https://github.com/reactjs/react-docgen/pull/48","diff_url":"https://github.com/reactjs/react-docgen/pull/48.diff","patch_url":"https://github.com/reactjs/react-docgen/pull/48.patch","issue_url":"https://api.github.com/repos/reactjs/react-docgen/issues/48","number":48,"state":"open","locked":false,"title":"[WIP] Support for flow types","user":{"login":"danez","id":231804,"avatar_url":"https://avatars.githubusercontent.com/u/231804?v=3","gravatar_id":"","url":"https://api.github.com/users/danez","html_url":"https://github.com/danez","followers_url":"https://api.github.com/users/danez/followers","following_url":"https://api.github.com/users/danez/following{/other_user}","gists_url":"https://api.github.com/users/danez/gists{/gist_id}","starred_url":"https://api.github.com/users/danez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danez/subscriptions","organizations_url":"https://api.github.com/users/danez/orgs","repos_url":"https://api.github.com/users/danez/repos","events_url":"https://api.github.com/users/danez/events{/privacy}","received_events_url":"https://api.github.com/users/danez/received_events","type":"User","site_admin":false},"body":"I started working on adding support for flow types.\r\n\r\nSo far I only tried to get it working for classes, and it already works nicely for this usecase, but only for string type and declared types. The code although is far away from nice yet. It also needs a patched version of ast-types, which I will create a PR also soon.\r\n\r\nI opened this PR already so that interested people can join and already have a look and maybe give feedback.\r\n\r\nWill fix #31\r\n\r\nThis needs to be done:\r\n\r\n- [x] support es6 classes\r\n- [x] ~~support createClass()~~\r\n- [x] support stateless components()\r\n- [x] support all types from flow\r\n  - [x] primitive types\r\n  - [x] class types\r\n  - [x] object signature\r\n  - [x] literal types\r\n  - [x] function signature\r\n  - [x] callable-object/function-object signature\r\n  - [x] maybe types\r\n  - [x] union\r\n  - [x] intersection\r\n- [x] support inline type definitions\r\n- [x] support declared type definitions\r\n- [x] extract description from type\r\n- [x] ~~handle imported type definitions (not really sure if we can do anything about that)~~\r\n- [x] add tests\r\n- [x] update ast-types to support Identifiers to TypeAlias\r\n- [ ] make code clean :)\r\n- [ ] adapt Readme","created_at":"2016-01-05T22:44:18Z","updated_at":"2016-01-13T16:32:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9d2590f9c2f15fea17bb04e6021334328aa9593c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/reactjs/react-docgen/pulls/48/commits","review_comments_url":"https://api.github.com/repos/reactjs/react-docgen/pulls/48/comments","review_comment_url":"https://api.github.com/repos/reactjs/react-docgen/pulls/comments{/number}","comments_url":"https://api.github.com/repos/reactjs/react-docgen/issues/48/comments","statuses_url":"https://api.github.com/repos/reactjs/react-docgen/statuses/55293560ebd5dd44f5d9bef91f0b379d3edc2759","head":{"label":"researchgate:add-flow-type-support","ref":"add-flow-type-support","sha":"55293560ebd5dd44f5d9bef91f0b379d3edc2759","user":{"login":"researchgate","id":1073651,"avatar_url":"https://avatars.githubusercontent.com/u/1073651?v=3","gravatar_id":"","url":"https://api.github.com/users/researchgate","html_url":"https://github.com/researchgate","followers_url":"https://api.github.com/users/researchgate/followers","following_url":"https://api.github.com/users/researchgate/following{/other_user}","gists_url":"https://api.github.com/users/researchgate/gists{/gist_id}","starred_url":"https://api.github.com/users/researchgate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/researchgate/subscriptions","organizations_url":"https://api.github.com/users/researchgate/orgs","repos_url":"https://api.github.com/users/researchgate/repos","events_url":"https://api.github.com/users/researchgate/events{/privacy}","received_events_url":"https://api.github.com/users/researchgate/received_events","type":"Organization","site_admin":false},"repo":{"id":49071489,"name":"react-docgen","full_name":"researchgate/react-docgen","owner":{"login":"researchgate","id":1073651,"avatar_url":"https://avatars.githubusercontent.com/u/1073651?v=3","gravatar_id":"","url":"https://api.github.com/users/researchgate","html_url":"https://github.com/researchgate","followers_url":"https://api.github.com/users/researchgate/followers","following_url":"https://api.github.com/users/researchgate/following{/other_user}","gists_url":"https://api.github.com/users/researchgate/gists{/gist_id}","starred_url":"https://api.github.com/users/researchgate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/researchgate/subscriptions","organizations_url":"https://api.github.com/users/researchgate/orgs","repos_url":"https://api.github.com/users/researchgate/repos","events_url":"https://api.github.com/users/researchgate/events{/privacy}","received_events_url":"https://api.github.com/users/researchgate/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/researchgate/react-docgen","description":"A CLI and toolbox to extract information from React component files for documentation generation purposes.","fork":true,"url":"https://api.github.com/repos/researchgate/react-docgen","forks_url":"https://api.github.com/repos/researchgate/react-docgen/forks","keys_url":"https://api.github.com/repos/researchgate/react-docgen/keys{/key_id}","collaborators_url":"https://api.github.com/repos/researchgate/react-docgen/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/researchgate/react-docgen/teams","hooks_url":"https://api.github.com/repos/researchgate/react-docgen/hooks","issue_events_url":"https://api.github.com/repos/researchgate/react-docgen/issues/events{/number}","events_url":"https://api.github.com/repos/researchgate/react-docgen/events","assignees_url":"https://api.github.com/repos/researchgate/react-docgen/assignees{/user}","branches_url":"https://api.github.com/repos/researchgate/react-docgen/branches{/branch}","tags_url":"https://api.github.com/repos/researchgate/react-docgen/tags","blobs_url":"https://api.github.com/repos/researchgate/react-docgen/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/researchgate/react-docgen/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/researchgate/react-docgen/git/refs{/sha}","trees_url":"https://api.github.com/repos/researchgate/react-docgen/git/trees{/sha}","statuses_url":"https://api.github.com/repos/researchgate/react-docgen/statuses/{sha}","languages_url":"https://api.github.com/repos/researchgate/react-docgen/languages","stargazers_url":"https://api.github.com/repos/researchgate/react-docgen/stargazers","contributors_url":"https://api.github.com/repos/researchgate/react-docgen/contributors","subscribers_url":"https://api.github.com/repos/researchgate/react-docgen/subscribers","subscription_url":"https://api.github.com/repos/researchgate/react-docgen/subscription","commits_url":"https://api.github.com/repos/researchgate/react-docgen/commits{/sha}","git_commits_url":"https://api.github.com/repos/researchgate/react-docgen/git/commits{/sha}","comments_url":"https://api.github.com/repos/researchgate/react-docgen/comments{/number}","issue_comment_url":"https://api.github.com/repos/researchgate/react-docgen/issues/comments{/number}","contents_url":"https://api.github.com/repos/researchgate/react-docgen/contents/{+path}","compare_url":"https://api.github.com/repos/researchgate/react-docgen/compare/{base}...{head}","merges_url":"https://api.github.com/repos/researchgate/react-docgen/merges","archive_url":"https://api.github.com/repos/researchgate/react-docgen/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/researchgate/react-docgen/downloads","issues_url":"https://api.github.com/repos/researchgate/react-docgen/issues{/number}","pulls_url":"https://api.github.com/repos/researchgate/react-docgen/pulls{/number}","milestones_url":"https://api.github.com/repos/researchgate/react-docgen/milestones{/number}","notifications_url":"https://api.github.com/repos/researchgate/react-docgen/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/researchgate/react-docgen/labels{/name}","releases_url":"https://api.github.com/repos/researchgate/react-docgen/releases{/id}","created_at":"2016-01-05T14:38:44Z","updated_at":"2016-01-11T21:51:38Z","pushed_at":"2016-01-13T16:31:33Z","git_url":"git://github.com/researchgate/react-docgen.git","ssh_url":"git@github.com:researchgate/react-docgen.git","clone_url":"https://github.com/researchgate/react-docgen.git","svn_url":"https://github.com/researchgate/react-docgen","homepage":null,"size":208,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"reactjs:master","ref":"master","sha":"3b3390d0f95c8e09739292d657adaba672a0655f","user":{"login":"reactjs","id":6412038,"avatar_url":"https://avatars.githubusercontent.com/u/6412038?v=3","gravatar_id":"","url":"https://api.github.com/users/reactjs","html_url":"https://github.com/reactjs","followers_url":"https://api.github.com/users/reactjs/followers","following_url":"https://api.github.com/users/reactjs/following{/other_user}","gists_url":"https://api.github.com/users/reactjs/gists{/gist_id}","starred_url":"https://api.github.com/users/reactjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reactjs/subscriptions","organizations_url":"https://api.github.com/users/reactjs/orgs","repos_url":"https://api.github.com/users/reactjs/repos","events_url":"https://api.github.com/users/reactjs/events{/privacy}","received_events_url":"https://api.github.com/users/reactjs/received_events","type":"Organization","site_admin":false},"repo":{"id":31441137,"name":"react-docgen","full_name":"reactjs/react-docgen","owner":{"login":"reactjs","id":6412038,"avatar_url":"https://avatars.githubusercontent.com/u/6412038?v=3","gravatar_id":"","url":"https://api.github.com/users/reactjs","html_url":"https://github.com/reactjs","followers_url":"https://api.github.com/users/reactjs/followers","following_url":"https://api.github.com/users/reactjs/following{/other_user}","gists_url":"https://api.github.com/users/reactjs/gists{/gist_id}","starred_url":"https://api.github.com/users/reactjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reactjs/subscriptions","organizations_url":"https://api.github.com/users/reactjs/orgs","repos_url":"https://api.github.com/users/reactjs/repos","events_url":"https://api.github.com/users/reactjs/events{/privacy}","received_events_url":"https://api.github.com/users/reactjs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/reactjs/react-docgen","description":"A CLI and toolbox to extract information from React component files for documentation generation purposes.","fork":false,"url":"https://api.github.com/repos/reactjs/react-docgen","forks_url":"https://api.github.com/repos/reactjs/react-docgen/forks","keys_url":"https://api.github.com/repos/reactjs/react-docgen/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reactjs/react-docgen/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reactjs/react-docgen/teams","hooks_url":"https://api.github.com/repos/reactjs/react-docgen/hooks","issue_events_url":"https://api.github.com/repos/reactjs/react-docgen/issues/events{/number}","events_url":"https://api.github.com/repos/reactjs/react-docgen/events","assignees_url":"https://api.github.com/repos/reactjs/react-docgen/assignees{/user}","branches_url":"https://api.github.com/repos/reactjs/react-docgen/branches{/branch}","tags_url":"https://api.github.com/repos/reactjs/react-docgen/tags","blobs_url":"https://api.github.com/repos/reactjs/react-docgen/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reactjs/react-docgen/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reactjs/react-docgen/git/refs{/sha}","trees_url":"https://api.github.com/repos/reactjs/react-docgen/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reactjs/react-docgen/statuses/{sha}","languages_url":"https://api.github.com/repos/reactjs/react-docgen/languages","stargazers_url":"https://api.github.com/repos/reactjs/react-docgen/stargazers","contributors_url":"https://api.github.com/repos/reactjs/react-docgen/contributors","subscribers_url":"https://api.github.com/repos/reactjs/react-docgen/subscribers","subscription_url":"https://api.github.com/repos/reactjs/react-docgen/subscription","commits_url":"https://api.github.com/repos/reactjs/react-docgen/commits{/sha}","git_commits_url":"https://api.github.com/repos/reactjs/react-docgen/git/commits{/sha}","comments_url":"https://api.github.com/repos/reactjs/react-docgen/comments{/number}","issue_comment_url":"https://api.github.com/repos/reactjs/react-docgen/issues/comments{/number}","contents_url":"https://api.github.com/repos/reactjs/react-docgen/contents/{+path}","compare_url":"https://api.github.com/repos/reactjs/react-docgen/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reactjs/react-docgen/merges","archive_url":"https://api.github.com/repos/reactjs/react-docgen/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reactjs/react-docgen/downloads","issues_url":"https://api.github.com/repos/reactjs/react-docgen/issues{/number}","pulls_url":"https://api.github.com/repos/reactjs/react-docgen/pulls{/number}","milestones_url":"https://api.github.com/repos/reactjs/react-docgen/milestones{/number}","notifications_url":"https://api.github.com/repos/reactjs/react-docgen/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reactjs/react-docgen/labels{/name}","releases_url":"https://api.github.com/repos/reactjs/react-docgen/releases{/id}","created_at":"2015-02-27T22:03:34Z","updated_at":"2016-01-13T05:19:48Z","pushed_at":"2016-01-13T16:31:33Z","git_url":"git://github.com/reactjs/react-docgen.git","ssh_url":"git@github.com:reactjs/react-docgen.git","clone_url":"https://github.com/reactjs/react-docgen.git","svn_url":"https://github.com/reactjs/react-docgen","homepage":null,"size":196,"stargazers_count":323,"watchers_count":323,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":9,"forks":23,"open_issues":9,"watchers":323,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/reactjs/react-docgen/pulls/48"},"html":{"href":"https://github.com/reactjs/react-docgen/pull/48"},"issue":{"href":"https://api.github.com/repos/reactjs/react-docgen/issues/48"},"comments":{"href":"https://api.github.com/repos/reactjs/react-docgen/issues/48/comments"},"review_comments":{"href":"https://api.github.com/repos/reactjs/react-docgen/pulls/48/comments"},"review_comment":{"href":"https://api.github.com/repos/reactjs/react-docgen/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/reactjs/react-docgen/pulls/48/commits"},"statuses":{"href":"https://api.github.com/repos/reactjs/react-docgen/statuses/55293560ebd5dd44f5d9bef91f0b379d3edc2759"}}}}