title: GraphQL response array getting empty out of nowhere right before return(??)
body: <p>So I'm trying to build a resolver for graphQL which is supposed to return an array of objects. The values for these objects come from a series of TypeORM selecting operations. And when I tried asking for a response in the graphql playground I only got empty arrays, so I started debugging the resolver using console.logs, but the thing is, inside the forEach loops I use the code seems to have the desired result: an array with objects in it. But when I log the same array right before returning it is empty:</p>
  <pre class="lang-js prettyprint-override"><code>  @Query(() =&gt; [response])
    async getTeacherFromSubjectName(
      @Arg(&quot;subjectName&quot;) subjectName: string, 
    ): Promise&lt;response[] | undefined&gt; {
      const subject = await Subject.findOne({name: subjectName}); 
      const subjectId = subject?.id; 
      let responseArray: response[] = []; 
  
      const qb = await getConnection()
        .createQueryBuilder()
        .select(&quot;teacher&quot;)
        .from(Teacher, &quot;teacher&quot;)
        .where(`teacher.subjectId = ${subjectId}`)
        .getMany()
  
      qb.forEach(async (teacher) =&gt; {
       const qb = await getConnection()
        .createQueryBuilder()
        .select(&quot;lectureTime&quot;)
        .from(LectureTime, &quot;lectureTime&quot;)
        .where(`lectureTime.teacherId = ${teacher.id}`)
        .getMany()
  
        responseArray.push( {
          teacher: teacher.name, 
          lectures: qb, 
        } ); 
        console.log(responseArray) // [{ teacher: 'Dirceu', lectures: [ [LectureTime] ] }, { teacher: 
                                       'Patrícia', lectures: [ [LectureTime], [LectureTime] ] } ]
      })
      
  
      console.log(responseArray) // []
      return responseArray; 
  
    }
  </code></pre>
  <p>What I get on the console is the following:
  <a href="https://i.stack.imgur.com/mHGx1.jpg" rel="nofollow noreferrer">link to image</a></p>
  <p>I actually have no idea of what is going on here, you can see in the image that the order of the logs is inverted (log right before return is circled in blue).</p>
  <p>I am certain that it is a silly problem and if you guys could point it out for me I would be very thankful.</p>