title: interdependent graphQl types
body: <p>I would like to design a graphQl schema in which two types are interdependent. basically I have a database structure in which:</p>
  
  <p><code>User.hasOne(Search)</code></p>
  
  <p>I would like to be able to make graphQl queries like this one:</p>
  
  <pre><code>// note that 'me' has User type
  // search has Search type
  query{
    me{
      email,
      search{
        content,
        user{
         id
        }
      }
    }
  }
  </code></pre>
  
  <p>So, you see that we request a <code>User</code>, its <code>Search</code> and the <code>User</code> owning  this <code>Search</code> (OK in this case this is not usefull at all).</p>
  
  <p>Here is what could be the definition of the <code>UserType</code>:</p>
  
  <pre><code>import {
    GraphQLObjectType as ObjectType,
    GraphQLID as ID,
    GraphQLString as StringType,
    GraphQLNonNull as NonNull,
    GraphQLInt as IntType,
  } from 'graphql';
  
  const UserType = new ObjectType({
    name: 'User',
    fields: {
      id: { type: new NonNull(ID) },
      username: { type: StringType },
      search: {
        type: SearchType,
        resolve(user){
          return user.getSearch();
        }
      },
    },
  });
  </code></pre>
  
  <p>Here is my definition of the <code>SearchType</code>:</p>
  
  <pre><code>const SearchType = new ObjectType({
    name: 'Search',
    fields: {
      id: { type: new NonNull(ID) },
      user: {
        type: UserType,
        resolve(search){
          return search.getUser();
        }
      },
      content: { type: StringType },
    },
  });
  </code></pre>
  
  <p>Unfortunatelly this does not work, I guess due to the interdependence between <code>UserType</code> ans <code>SearchType</code>, and I get the following error:</p>
  
  <pre><code>User.search field type must be Output Type but got: function type() {
    return _SearchType2.default;
  }
  </code></pre>
  
  <p>Is there any way I could implement this inter dependency between <code>User</code> and <code>Search</code>?</p>