{"action":"created","issue":{"url":"https://api.github.com/repos/brigand/babel-plugin-flow-react-proptypes/issues/71","repository_url":"https://api.github.com/repos/brigand/babel-plugin-flow-react-proptypes","labels_url":"https://api.github.com/repos/brigand/babel-plugin-flow-react-proptypes/issues/71/labels{/name}","comments_url":"https://api.github.com/repos/brigand/babel-plugin-flow-react-proptypes/issues/71/comments","events_url":"https://api.github.com/repos/brigand/babel-plugin-flow-react-proptypes/issues/71/events","html_url":"https://github.com/brigand/babel-plugin-flow-react-proptypes/issues/71","id":210184600,"number":71,"title":"propTypes are not created if you assign props from a pre-defined type or if you import types from another file","user":{"login":"faceyspacey","id":154732,"avatar_url":"https://avatars3.githubusercontent.com/u/154732?v=3","gravatar_id":"","url":"https://api.github.com/users/faceyspacey","html_url":"https://github.com/faceyspacey","followers_url":"https://api.github.com/users/faceyspacey/followers","following_url":"https://api.github.com/users/faceyspacey/following{/other_user}","gists_url":"https://api.github.com/users/faceyspacey/gists{/gist_id}","starred_url":"https://api.github.com/users/faceyspacey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/faceyspacey/subscriptions","organizations_url":"https://api.github.com/users/faceyspacey/orgs","repos_url":"https://api.github.com/users/faceyspacey/repos","events_url":"https://api.github.com/users/faceyspacey/events{/privacy}","received_events_url":"https://api.github.com/users/faceyspacey/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-02-24T23:24:23Z","updated_at":"2017-04-02T08:24:50Z","closed_at":null,"body":"For example the following won't work:\r\n\r\n```\r\nconst Link = ({ href, children }: Props) =>\r\n   <a href={href}>children</a>\r\n\r\ntype Props = {\r\n   href: string,\r\n   children: any,\r\n}\r\n```\r\n\r\nwhereas this will:\r\n\r\n```\r\nconst Link = ({ href, children }: {\r\n   href: string,\r\n   children: any,\r\n}) =>\r\n   <a href={href}>children</a>\r\n```\r\n\r\nIn addition, if you import types, from other files, the type won't in fact be created in the other file. There will be nothing there. That problem becomes even worse if you're using types imported from packages, e.g. the `react-redux` flowtypes, eg if you're doing something like the following you're screwed:\r\n\r\n```\r\nimport React from 'react'\r\nimport { connect } from 'react-redux'\r\nimport type { Store } from 'redux'\r\nimport type { Connector } from 'react-redux'\r\n\r\nimport type { Href } from './hrefToUrl' // no flow type will be converted to a propType in the other file\r\n\r\ntype OwnProps = {\r\n  href: Href, \r\n  children: any, \r\n}\r\n\r\ntype Props = {\r\n  dispatch: Function,\r\n} & OwnProps // doubt an intersection will work\r\n\r\ntype Context = {\r\n  store: Store,\r\n}\r\n\r\nconst Link = ({ href, children }: Props) => // Props wont work cuz its not defined here\r\n   <a href={href} onPress={(e) => e.preventDefault() || dispatch({ type: 'FOO' })}>{children}</a>\r\n\r\nconst connector: Connector<OwnProps, Props> = connect() // yea right, not happening\r\n\r\nexport default connector(Link)\r\n```\r\n\r\nSo in short, any serious code using redux (or any 3rd party types, *or any of your own imported files*) unfortunately won't work with this otherwise great package."},"comment":{"url":"https://api.github.com/repos/brigand/babel-plugin-flow-react-proptypes/issues/comments/290972310","html_url":"https://github.com/brigand/babel-plugin-flow-react-proptypes/issues/71#issuecomment-290972310","issue_url":"https://api.github.com/repos/brigand/babel-plugin-flow-react-proptypes/issues/71","id":290972310,"user":{"login":"max-mykhailenko","id":1213198,"avatar_url":"https://avatars0.githubusercontent.com/u/1213198?v=3","gravatar_id":"","url":"https://api.github.com/users/max-mykhailenko","html_url":"https://github.com/max-mykhailenko","followers_url":"https://api.github.com/users/max-mykhailenko/followers","following_url":"https://api.github.com/users/max-mykhailenko/following{/other_user}","gists_url":"https://api.github.com/users/max-mykhailenko/gists{/gist_id}","starred_url":"https://api.github.com/users/max-mykhailenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/max-mykhailenko/subscriptions","organizations_url":"https://api.github.com/users/max-mykhailenko/orgs","repos_url":"https://api.github.com/users/max-mykhailenko/repos","events_url":"https://api.github.com/users/max-mykhailenko/events{/privacy}","received_events_url":"https://api.github.com/users/max-mykhailenko/received_events","type":"User","site_admin":false},"created_at":"2017-04-02T08:24:50Z","updated_at":"2017-04-02T08:24:50Z","body":"@brigand maybe you know another way to define types across the files, maybe `import` all definitions?"}}
{"actor":{"display_login":"max-mykhailenko"}}