{"action":"created","issue":{"url":"https://api.github.com/repos/apollographql/react-apollo/issues/2568","repository_url":"https://api.github.com/repos/apollographql/react-apollo","labels_url":"https://api.github.com/repos/apollographql/react-apollo/issues/2568/labels{/name}","comments_url":"https://api.github.com/repos/apollographql/react-apollo/issues/2568/comments","events_url":"https://api.github.com/repos/apollographql/react-apollo/issues/2568/events","html_url":"https://github.com/apollographql/react-apollo/issues/2568","id":377767120,"node_id":"MDU6SXNzdWUzNzc3NjcxMjA=","number":2568,"title":"Typescript graphql() hoc issue with option.prop and ChildDataProps typings","user":{"login":"slorber","id":749374,"node_id":"MDQ6VXNlcjc0OTM3NA==","avatar_url":"https://avatars0.githubusercontent.com/u/749374?v=4","gravatar_id":"","url":"https://api.github.com/users/slorber","html_url":"https://github.com/slorber","followers_url":"https://api.github.com/users/slorber/followers","following_url":"https://api.github.com/users/slorber/following{/other_user}","gists_url":"https://api.github.com/users/slorber/gists{/gist_id}","starred_url":"https://api.github.com/users/slorber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slorber/subscriptions","organizations_url":"https://api.github.com/users/slorber/orgs","repos_url":"https://api.github.com/users/slorber/repos","events_url":"https://api.github.com/users/slorber/events{/privacy}","received_events_url":"https://api.github.com/users/slorber/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-06T09:50:25Z","updated_at":"2018-11-06T09:54:50Z","closed_at":null,"author_association":"NONE","body":"\r\n\r\n**Intended outcome:**\r\n\r\nThe documentation TS examples should work.\r\n\r\n**Actual outcome:**\r\n\r\nThe documentation TS examples do not compile due to typings related to the \"prop\" option and ChildDataProp\r\n\r\nhttps://www.apollographql.com/docs/react/recipes/static-typing.html#props\r\n\r\n**How to reproduce the issue:**\r\n\r\nCreate a project with the example here: https://www.apollographql.com/docs/react/recipes/static-typing.html#props\r\n\r\n**Version**\r\n\r\n- apollo-client@latest\r\n- react-apollo@latest\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/apollographql/react-apollo/issues/comments/436194756","html_url":"https://github.com/apollographql/react-apollo/issues/2568#issuecomment-436194756","issue_url":"https://api.github.com/repos/apollographql/react-apollo/issues/2568","id":436194756,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNjE5NDc1Ng==","user":{"login":"slorber","id":749374,"node_id":"MDQ6VXNlcjc0OTM3NA==","avatar_url":"https://avatars0.githubusercontent.com/u/749374?v=4","gravatar_id":"","url":"https://api.github.com/users/slorber","html_url":"https://github.com/slorber","followers_url":"https://api.github.com/users/slorber/followers","following_url":"https://api.github.com/users/slorber/following{/other_user}","gists_url":"https://api.github.com/users/slorber/gists{/gist_id}","starred_url":"https://api.github.com/users/slorber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slorber/subscriptions","organizations_url":"https://api.github.com/users/slorber/orgs","repos_url":"https://api.github.com/users/slorber/repos","events_url":"https://api.github.com/users/slorber/events{/privacy}","received_events_url":"https://api.github.com/users/slorber/received_events","type":"User","site_admin":false},"created_at":"2018-11-06T09:54:50Z","updated_at":"2018-11-06T09:54:50Z","author_association":"NONE","body":"cc @danilobuerger? \r\n\r\nThis compile with:\r\n\r\n```js\r\ntype ChildProps = ChildDataProps<InputProps, Response, Variables>;\r\n\r\nconst withCharacter = graphql<InputProps, Response, Variables, ChildProps>(HERO_QUERY, {\r\n  options: ({ episode }) => ({\r\n    variables: { episode }\r\n  }),\r\n  props: ({ data, ownProps }) => {\r\n    const props: ChildProps  = { data: data!, ...ownProps }\r\n    return props;\r\n  }\r\n});\r\n```\r\n\r\nalternatively I could write my own ChildProps type.\r\n\r\nAlso note that prop receives an optional `DataProp<>` type, which can be undefined, while the ChildDataProp expect it to always be there.\r\n\r\nI'm a typescript newbie but from what I understand I suspect we should rather have something like `type ChildDataProps = TProps & (DataProps<TData, TGraphQLVariables> | undefined)`. Current form of ChildDataProps seems not really helpful.\r\n\r\nAlso note that the example repo does not contain any TS example based on the graphql HOC. This would be helpful to ensure the types are correct.\r\n\r\nhttps://github.com/apollographql/react-apollo/tree/master/examples/typescript/src"}}
{"actor":{"display_login":"slorber"}}