title: Troubles with array of objects interface in Typescript
body: <p>I have an array which is state entry that I populate in <code>componentDidMount</code> lifecycle hook, and it is quite simple:</p>
  
  <pre><code>state{
        array:[{a:0,b:0},{a:1,b:1},{a:2,b:2}]
       }
  </code></pre>
  
  <p>When I try to access it, however I am always getting an error: </p>
  
  <p><code>Property 'a' does not exist on type 'never'.</code></p>
  
  <p>I think I am having troubles with declaring an interface here, can't find a proper way to do that.
  Something like this would probably do:</p>
  
  <pre><code>interface IState{
       array: object[]
  }
  </code></pre>
  
  <p>Full version of component :</p>
  
  <pre><code>import * as React from "react";
  import phrasalVerbs from "../data/phrasalVerbs";
  
  interface IAnswerOptions {
     pVerb: string;
     meaning: string;
   }
  
  interface IState {
    pVerbs: object;
    progress: number;
    answerOptions: IAnswerOptions[];
  }
  
  class PhrasalVerbs extends React.Component&lt;{}, IState&gt; {
    public state = {
      pVerbs: phrasalVerbs,
      progress: 0,
      answerOptions: []
    };
  
    public componentDidMount() {
      this.randomVariants();
    }
  
    public randomVariants = () =&gt; {
      let randomVariants: any[] = [];
      const currentVerbs = this.state.pVerbs.data;
      const shuffledVerbs = currentVerbs
        .map(a =&gt; [Math.random(), a])
        .sort((a: any, b: any): any =&gt; a[0] - b[0])
        .map(a =&gt; a[1]);
      randomVariants = [shuffledVerbs[0], shuffledVerbs[1], shuffledVerbs[2]];
      this.setState({
        ...this.state,
        answerOptions: randomVariants
      });
    };
  
    public render() {
      const { pVerbs, progress } = this.state;
  
      return (
        &lt;div&gt;
          &lt;div&gt;{pVerbs.data[progress].pVerb}&lt;/div&gt;
          {/* &lt;div&gt;
            {this.state.answerOptions
              ? this.state.answerOptions[0].meaning
              : null}
          &lt;/div&gt; */}
        &lt;/div&gt;
      );
    }
  }
  
  export default PhrasalVerbs;
  </code></pre>