title: Nest JS & TypeORM cannot use findOne properly
body: <p>I am trying to get a user instance based on <code>id</code> (same happens for other attributes such as <code>email</code>. Inside the Service, this is my code:</p>
  <pre class="lang-js prettyprint-override"><code>@Injectable()
  export class UserService {
    @InjectRepository(User)
    private readonly repository: Repository&lt;User&gt;;
  
    async findOne(id: number): Promise&lt;User&gt; {
      const user = await this.repository.findOne(id);
      return user;
    }
  }
  </code></pre>
  <p>and my User entity is:</p>
  <pre class="lang-js prettyprint-override"><code>@Entity()
  export class User {
    @PrimaryGeneratedColumn()
    public id: number;
  
    @Column({ type: 'varchar', length: 120 })
    public name: string;
  
    @Column({ type: 'varchar', length: 120 })
    public email: string;
  }
  </code></pre>
  <p>The problem is that I always get this error:
  <code>src/api/user/user.service.ts - error TS2559: Type 'number' has no properties in common with type 'FindOneOptions&lt;User&gt;'.</code></p>
  <p>Other methods such as <code>getAll</code> work just fine:</p>
  <pre class="lang-js prettyprint-override"><code>public getAllUsers(): Promise&lt;User[]&gt; {
    return this.repository.find();
  }
  </code></pre>