title: graphql with typescript - @FieldResolver not working in compiled-to-js type-graphql
body: <p>I a newbie with type-graphql and I have this weird issue of field resolvers not working.</p>
  <p>I'm using a stack of:</p>
  <ul>
  <li>typescript(3.9.5)</li>
  <li>type-graphql(1.0.0)</li>
  <li>typeorm(0.2.25)</li>
  <li>apollo(2.16.0).</li>
  </ul>
  <p>Whenever I run my typescript (using ts-node) everything works well, but when I use the compiled js version with express, the queries work only with simple db fields, but fieldResolvers don't work at all and in the end I get &quot;Cannot return null for non-nullable field&quot;.
  The funny thing is that the field resolvers are sibling of query resolvers in the same @Resolver class. the queries get fired (placed a console log) but the field resolvers never do. anyone have a clue?</p>
  <p>here are some snippets from the code:</p>
  <pre><code>@Entity()
  @ObjectType()
  export class Member extends BaseEntity {
    @Field(() =&gt; ID)
    @PrimaryGeneratedColumn()
    id: string;
  
    @UseForSearch()
    @UseAsTitle()
    @Field(() =&gt; String)
    @IsEmail()
    @Column({ type: 'varchar', unique: true })
    email: string;
  
    @Field(() =&gt; [Item])
    @OneToMany(type =&gt; Item, item =&gt; item.member)
    items?: Item[];
  
    @OneToMany(type =&gt; Review, review =&gt; review.member)
    reviews?: Review[];
  
    @Field(() =&gt; Number)
    itemsCount: number;
  }
  
  </code></pre>
  <pre><code>@Entity()
  @ObjectType()
  export class Item extends BaseEntity {
    @Field(() =&gt; ID)
    @PrimaryGeneratedColumn()
    id: string;
  
    @ManyToOne(type =&gt; Category, category =&gt; category.items)
    @JoinColumn({ name: 'categoryId' })
    @Field(() =&gt; Category)
    category?: Category;
  
    @Field(() =&gt; String, { nullable: true })
    @Column({
      nullable: true,
    })
    name: string;
  
    @ManyToOne(type =&gt; Member, member =&gt; member.items)
    @JoinColumn({ name: 'memberId' })
    @Field(() =&gt; Member)
    member?: Member;
  
    @Field(() =&gt; ID)
    @Column('int', { nullable: true })
    public memberId: number | null;
  }
  </code></pre>
  <pre><code>import { Resolver, Query, FieldResolver, Root, Ctx, Arg } from 'type-graphql';
  import { getRepository, Repository } from 'typeorm';
  import { Item } from '../entity';
  import { Member } from '../entity/member';
  
  @Resolver(of =&gt; Member)
  export class MemberResolver {
    constructor(private itemsRepository: Repository&lt;Item&gt;) {
      this.itemsRepository = getRepository(Item);
    }
  
    @Query(() =&gt; [Member])
    members() {
      console.log('in members query');
      return Member.find();
    }
  
    @FieldResolver()
    async items(@Root() member: Member) {
      return await this.itemsRepository.find({ where: { memberId: member.id } });
    }
  
    @FieldResolver()
    async itemsCount(@Root() member: Member) {
      console.log('in itemsCount resolver');
      return this.itemsRepository.count({ where: { memberId: member.id } });
    }
  
  </code></pre>
  <pre><code>query {
    members {
      email
      itemsCount
    }
  }
  </code></pre>
  <pre><code>{
    &quot;errors&quot;: [
      {
        &quot;message&quot;: &quot;Cannot return null for non-nullable field Member.itemsCount.&quot;,
        &quot;locations&quot;: [
          {
            &quot;line&quot;: 4,
            &quot;column&quot;: 5
          }
        ],
        &quot;path&quot;: [
          &quot;members&quot;,
          0,
          &quot;itemsCount&quot;
        ],
        &quot;extensions&quot;: {
          &quot;code&quot;: &quot;INTERNAL_SERVER_ERROR&quot;,
          &quot;exception&quot;: {
            &quot;stacktrace&quot;: [
              &quot;Error: Cannot return null for non-nullable field Member.itemsCount.&quot;,
              &quot;    at completeValue (/Users/admin/tackar/clampa/clampa-server/node_modules/graphql/execution/execute.js:599:13)&quot;,
              &quot;    at completeValueCatchingError (/Users/admin/tackar/clampa/clampa-server/node_modules/graphql/execution/execute.js:534:19)&quot;,
              &quot;    at resolveField (/Users/admin/tackar/clampa/clampa-server/node_modules/graphql/execution/execute.js:465:10)&quot;,
              &quot;    at executeFields (/Users/admin/tackar/clampa/clampa-server/node_modules/graphql/execution/execute.js:297:18)&quot;,
              &quot;    at collectAndExecuteSubfields (/Users/admin/tackar/clampa/clampa-server/node_modules/graphql/execution/execute.js:752:10)&quot;,
              &quot;    at completeObjectValue (/Users/admin/tackar/clampa/clampa-server/node_modules/graphql/execution/execute.js:742:10)&quot;,
              &quot;    at completeValue (/Users/admin/tackar/clampa/clampa-server/node_modules/graphql/execution/execute.js:630:12)&quot;,
              &quot;    at completeValue (/Users/admin/tackar/clampa/clampa-server/node_modules/graphql/execution/execute.js:596:21)&quot;,
              &quot;    at completeValueCatchingError (/Users/admin/tackar/clampa/clampa-server/node_modules/graphql/execution/execute.js:534:19)&quot;,
              &quot;    at /Users/admin/tackar/clampa/clampa-server/node_modules/graphql/execution/execute.js:655:25&quot;
            ]
          }
        }
      }
    ],
    &quot;data&quot;: null
  }
  </code></pre>