title: How do I implement GraphQL resolvers in Typescript with Graphql-codegen?
body: <p>In an effort to teach myself Apollo Server I was implementing the schema described <a href="https://www.apollographql.com/docs/apollo-server/data/resolvers/" rel="nofollow noreferrer">here</a>.  CodeGen generated what look like very sensible definitions for the types.</p>
  <pre><code>export type Book = {
    __typename?: 'Book';
    author: Author;
    title: Scalars['String'];
  };
  
  export type Library = {
    __typename?: 'Library';
    books?: Maybe&lt;Array&lt;Book&gt;&gt;;
    branch: Scalars['String'];
  };
  </code></pre>
  <p>The problem was the (Javascript) given in the example, equally sensibly, gave data for books and libraries as</p>
  <pre><code>  {
      branch: &quot;riverside&quot;,
    }
  </code></pre>
  <p>and</p>
  <pre><code>  {
      title: &quot;The Awakening&quot;,
      author: &quot;Kate Chopin&quot;,
      branch: &quot;riverside&quot;,
    }
  </code></pre>
  <p>That is, in the Javascript, each child had the ID of its parent, but in the GraphQL, each parent had an array of its actual children.</p>
  <p>When I applied the <code>Resolvers</code> type, of course, the compiler complained.  Where is the child array? it asked plaintively.</p>
  <p>You are supposed to figure that out at run-time, if you are even asked.  Stupid computer.</p>
  <p>Both Apollo and GraphQL CodeGen are very professional products.  They would not have omitted something this basic.  What am I missing?</p>
  <p>(Incidentally, I think, but am really not sure, that <a href="https://stackoverflow.com/questions/61088512/graphql-codegen-problem-with-generating-typescript-interfaces-from-graphql-inter">this question</a> springs from the same issue.)</p>