You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importReactfrom"react";importgqlfrom"graphql-tag";import{graphql}from"react-apollo";constHERO_QUERY=gql` query GetCharacter($episode: Episode!) { hero(episode: $episode) { name id friends { name id appearsIn } } }`;typeHero={name: string;id: string;appearsIn: string[];friends: Hero[];};typeResponse={hero: Hero;};typeVariables={episode: string;};// note the first parameter is empty here, we will exaplain that belowconstwithCharacter=graphql<{},Response,Variables>(HERO_QUERY,{options: ()=>({variables: {episode: "JEDI"}})});exportdefaultwithCharacter(({data: { loading, hero, error }})=>{if(loading)return<div>Loading</div>;if(error)return<h1>ERROR</h1>;return ...//actualcomponentwithdata;});
When disabling the strictNullChecks another error appears.
Version
apollo-client@2.3.1
The text was updated successfully, but these errors were encountered:
If you're able to share a reproduction that outlines what you've tried, and what isn't working, that would definitely help with troubleshooting. That code sample isn't complete, so it's a bit difficult to pinpoint the problem you're encountering (e.g. return ... is invalid). I'll close this for now, but if you're able to share your code, let us know - thanks!
I am trying the Typescript example from Docs
receive:
How to reproduce the issue:
tsconfig.json
Example from https://www.apollographql.com/docs/react/recipes/static-typing.html
When disabling the strictNullChecks another error appears.
Version
The text was updated successfully, but these errors were encountered: