title: ES6 Map in Flowtype
body: <p>What is the <strong>appropriate way</strong> to deal with <a href="/questions/tagged/ecmascript-6" class="post-tag" title="show questions tagged &#39;ecmascript-6&#39;" rel="tag">ecmascript-6</a> <code>Map</code> objects in <a href="/questions/tagged/flowtype" class="post-tag" title="show questions tagged &#39;flowtype&#39;" rel="tag">flowtype</a>?</p>
  
  <pre><code>const animals:Map&lt;id, Animal&gt; = new Map();
  
  function feedAnimal(cageNumber:number) {
      const animal:Animal = animals.get(cageNumber);
  
      ...
  }
  </code></pre>
  
  <p>Error</p>
  
  <pre><code>const animal:Animal = animals.get(cageNumber);
                        ^^^^^^^^^^^^^^^^^^^^^^^^ call of method `get`
  
  const animal:Animal = animals.get(cageNumber);
                        ^^^^^^^^^^^^^^^^^^^^^^^^ undefined. This type is incompatible with
  const animal:Animal = animals.get(cageNumber);
                        ^^^^^^^ Animal
  </code></pre>
  
  <p><a href="https://github.com/facebook/flow/blob/ff07cd569eaa06dad72ba72ae2df37cf2eb14933/lib/core.js#L447-L462" rel="noreferrer">Flowtype Map declaration</a></p>