title: How can I rewrite this reduce function in typescript?
body: <p>I'm currently trying to convert some react native code to typescript, and there's a few reduce functions that are throwing errors. How can I rewrite this so that I do not have type issues when I run?</p>
  
  <p>I've tried different ways of trying to type the function as well as the expected output, but no luck so far.</p>
  
  <pre><code>myArray: data.items.reduce( (map: object, obj: myInterface) : object  =&gt; { map[obj.id] = obj; return map; }, [])
  </code></pre>
  
  <p>the myArray item of my object should be populated with an array of items defined in myInterface. When I run I'm currently getting the following error. </p>
  
  <pre><code>TypeScript error in MyPath/:
  
  Element implicitly has an 'any' type because expression of type 'number' can't be used to index type '{}'.
    No index signature with a parameter of type 'number' was found on type '{}'.  TS7053
  
      128 |                 appVersion: data.version || "",
      129 |                 offline: false,
      130 |                 myArray: data.items.reduce( (map: object, obj: myInterface) : object  =&gt; { map[obj.id] = obj; return map; }, [])
          |                                                                                           ^
      131 |             });
  </code></pre>