title: Type script and Azure POI values
body: <p>I am new to React/Type script</p>
  <ol>
  <li><p>trying to figure out how I can access the value of the variable data2 for my return statement</p>
  </li>
  <li><p>How I can add the results to a collection and have the entire collection available outside of the block. So maybe like a dataSource collection.</p>
  </li>
  <li><p>Want to be able to return dataSource collection to the calling function.</p>
  <pre><code> const getAllLocations = (query: string): GeoJSON.FeatureCollection&lt;GeoJSON.Point&gt; =&gt; {
       let data2: GeoJSON.FeatureCollection&lt;GeoJSON.Point&gt; = {};
       let dataSource = {};
       searchURL
         .searchPOI(atlasService.Aborter.timeout(10000), query, {
           maxFuzzyLevel: 4,
           view: &quot;Auto&quot;,
         })
         .then((results) =&gt; {
           data2 = results.geojson.getFeatures();
           console.log(&quot;inside&quot;);
           console.log(data2);
           dataSource.Add(data1);
         });
       console.log(&quot;outside&quot;);
       console.log(data2);
       console.log(datasource);
       return data2, datasource;  // Both these are empty
   };
  </code></pre>
  </li>
  </ol>