title: TypeScript Error - Type 'Ticket[] | undefined' is not an array type
body: <p>How do I append an item to an array of objects to a state (React) while using TS?</p>
  <p>This is my code:</p>
  <pre><code>export type AppState = {
      tickets?: Ticket[],
  }
  
  export type Ticket = {
      id: string,
      title: string;
  }
  
  export type ApiC = {
      getTickets: (order:string, page:number) =&gt; Promise&lt;Ticket[]&gt;;
  }
  
  export class App extends React.PureComponent&lt;{}, AppState&gt; {
  
      state: AppState = {
      }
  
  
     fetchNewData = async () =&gt; {
          return await api.getTickets(this.state.currentOrder, this.state.page)
     }
  
      handleLoadMore = () =&gt; {
  
         let addData:Promise&lt;Ticket[]&gt; = this.fetchNewData()
  
          if (addData) 
              this.setState({
                  tickets: [...this.state.tickets, addData]
              })
      }
  </code></pre>
  <p>I keep getting this error:</p>
  <blockquote>
  <p>Type 'Ticket[] | undefined' is not an array type.</p>
  </blockquote>
  <p>I tried:</p>
  <pre><code>let addData:Ticket[] = this.fetchNewData()
  </code></pre>
  <p>too and the error I get:</p>
  <blockquote>
  <p>Type 'Promise&lt;Ticket[]&gt;' is missing the following properties from type
  'Ticket[]': length, pop, push, concat, and 28 more. Type 'Ticket[] |
  undefined' is not an array type.</p>
  </blockquote>
  <p>I tried writing it in all kind of variations with no luck.</p>
  <p><strong>Both pointing error in this line</strong>:</p>
  <pre><code>  &gt; 144 |               tickets: [...this.state.tickets, addData]
          |                            ^
  </code></pre>