title: Filtering array with promise in typescript
body: <pre><code>if (filterLabel) {
  result = result.filter((r) =&gt;
    (r.labels).map((l) =&gt; l.name === filterLabel));}
  </code></pre>
  <p>The Error is &quot;Property 'map' does not exist on type 'Promise&lt;Label[]&gt;'&quot;.</p>
  <p>How can I filter this array? filterlabel is a name of a Label like &quot;Test1&quot;</p>
  <pre><code>export class Task {
  // eslint-disable-next-line new-cap
  @PrimaryGeneratedColumn()
  id: number;
  
  // eslint-disable-next-line new-cap
  @Column()
  name: string;
  
  // eslint-disable-next-line new-cap
  @Column()
  description: string;
  
  // eslint-disable-next-line new-cap
  @CreateDateColumn()
  created: string;
  
  // eslint-disable-next-line new-cap
  @UpdateDateColumn()
  updated: string;
  
  // eslint-disable-next-line new-cap
  @ManyToMany(() =&gt; Label, (label) =&gt; label.tasks)
  // eslint-disable-next-line new-cap
  @JoinTable()
  labels: Promise&lt;Label[]&gt;;
  
  // eslint-disable-next-line new-cap
  @OneToMany(() =&gt; Tracking, (tracking) =&gt; tracking.task, {nullable: true})
  
  trackings: Promise&lt;Tracking[]&gt;;
  </code></pre>
  <p>}</p>
  <pre><code>export const getAllTasks = async (req, res) =&gt; {
  const taskRepository = getRepository(Task);
  const tasks = await taskRepository.find(
    {relations: ['trackings', 'labels']});
  
   const {filterTask, filterDescription, filterLabel} = req.query;
   console.log('1', filterTask, '2', filterDescription, '3', filterLabel, 
   '4');
   let result = [...tasks];
  
   if (filterTask) {
   result = result.filter((r) =&gt; r.name === filterTask);
   }
   if (filterLabel) {
    filter();
   }
   if (filterDescription) {
     result = result.filter((d) =&gt; d.description === filterDescription);
   }
    res.status(200).send({data: result});
   };
  </code></pre>
  <p>How can i Filter for labels? I dont understand it.
  The other filters are right but the label filter is bad because of the promises</p>