title: Typescript - Index signature is missing in type - Contextual Typing
body: <p>I have the following class and a subclass</p>
  
  <pre><code>export class FlightInfoModel {
      carrierName?: string;
      originCode?: string;
      destCode?: string;
      flightDetails: FlightSegmentEntity[];
  
      constructor() {
          this.carrierName = "";
          this.originCode = "";
          this.destCode = "";
          this.flightDetails = new Array&lt;FlightSegmentEntity&gt;();
      }
  }
  
  export class FlightSegmentEntity {
    CarrierCode: string;
    FlightNo: string;
    Aircraft: string;
  
    OriginCode: string;
    DestinationCode: string;
  
    DepartureDate: string;
    ArrivalDate: string;
  
    FlightDuration: number;
    StopOverDuration: string;
  
    constructor() {
      this.CarrierCode = "";
      this.FlightNo = "";
      this.Aircraft = "";
      this.OriginCode = "";
      this.DestinationCode = "";
      this.DepartureDate = "";
      this.ArrivalDate = "";
      this.FlightDuration = -1;
      this.StopOverDuration = "";
    }
  </code></pre>
  
  <p>I am using Typescript and UnderscoreJS to write the following function. flight is the FlightInfoModel  object and flightDetails is the FlightSegmentEntity[]</p>
  
  <pre><code>_.reduce(flight.flightDetails,
  function(memo, seg){ return memo + seg.FlightDuration + seg.StopOverDuration; },
  0)
  </code></pre>
  
  <p>The underscore function accepts an array collection but I keep getting the following error</p>
  
  <p>error TS2345: Argument of type 'FlightSegmentEntity[]' is not assignable to parameter
  of type 'Dictionary&lt;{}>'.
    Index signature is missing in type 'FlightSegmentEntity[]'.</p>
  
  <p>I have read a lot about the contextual typing that Typescript requires and tried doing that but to no avail. BTW I am using Typescript 2.3.4</p>