title: Error when building typedefs TypeError: Cannot read property 'some' of undefined
body: <p>I am getting the following error when building Typedefs in Apollo Server:</p>
  <pre><code>return typeDef.definitions.some(definition =&gt; definition.kind === language_1.Kind.DIRECTIVE_DEFINITION &amp;&amp;
                                     ^
  TypeError: Cannot read property 'some' of undefined
  
  </code></pre>
  <p>I tried to follow some solutions from here <a href="https://github.com/apollographql/apollo-server/issues/2961" rel="nofollow noreferrer">https://github.com/apollographql/apollo-server/issues/2961</a> but still, I am getting the error.</p>
  <p>This is how I am creating the schema:</p>
  <pre><code>fs.readdirSync(__dirname)
   .filter(dir =&gt; { console.log('dir', dir); return dir.indexOf('.') &lt; 0 })
   .forEach((dir) =&gt; {
      const tmp = require(path.join(__dirname, dir)).default;
      resolvers = merge(resolvers, tmp.resolvers);
      typeDefs.push(tmp.types);
   });
  
  const schema = new ApolloServer({
    typeDefs,
    resolvers, 
    playground: {
      endpoint: '/graphql',
      settings: {
        'editor.theme': 'light'
      }
    }
  });
  </code></pre>
  <p>type.js</p>
  <pre><code>const Book = gql`
    type Book {
      title: String!
      author: String!
    }
  `;
  
  export const types = () =&gt; [Book];
  
  export const typeResolvers = {
  
  };
  </code></pre>
  <p>mutation.js</p>
  <pre><code>const Mutation = gql`
    extend type Mutation {
      addBook(book: BookInput): Book
    }
  `;
  
  export const mutationTypes = () =&gt; [Mutation];
  
  export const mutationResolvers = {
    Mutation: {
      addBook: async (_, args, ctx) =&gt; {
        return []
      }
    }
  };
  </code></pre>
  <p>index.js</p>
  <pre><code>export default {
    types: () =&gt; [types, queryTypes, inputTypes, mutationTypes],
    resolvers: Object.assign(queryResolvers, mutationResolvers, typeResolvers),
  };
  </code></pre>
  <p>Any suggestions? What could I be missing?</p>