title: How to create generics with the schema language?
body: <p>Using facebook's reference library, I found a way to hack generic types like this:</p>
  
  <pre><code>type PagedResource&lt;Query, Item&gt; = (pagedQuery: PagedQuery&lt;Query&gt;) =&gt; PagedResponse&lt;Item&gt;
  ​
  interface PagedQuery&lt;Query&gt; {
    query: Query;
    take: number;
    skip: number;
  }
  ​
  interface PagedResponse&lt;Item&gt; {
    items: Array&lt;Item&gt;; 
    total: number;
  }
  </code></pre>
  
  <hr>
  
  <pre><code>function pagedResource({type, resolve, args}) {
    return {
      type: pagedType(type),
      args: Object.assign(args, {
        page: { type: new GraphQLNonNull(pageQueryType()) }
      }),
      resolve
    };
    function pageQueryType() {
      return new GraphQLInputObjectType({
        name: 'PageQuery',
        fields: {
          skip: { type: new GraphQLNonNull(GraphQLInt) },
          take: { type: new GraphQLNonNull(GraphQLInt) }
        }
      });
    }
    function pagedType(type) {
      return new GraphQLObjectType({
        name: 'Paged' + type.toString(),
        fields: {
          items: { type: new GraphQLNonNull(new GraphQLList(type)) },
          total: { type: new GraphQLNonNull(GraphQLInt) }
        }
      });
    }
  }
  </code></pre>
  
  <p>But I like how with Apollo Server I can declaratively create the schema. So question is, how do you guys go about creating generic-like types with the schema language?</p>