title: Using ReadonlyMap<K, V> type
body: <p>TypeScript defines <code>ReadonlyMap&lt;K, V&gt;</code> interface which is immutable version of standard JavaScript <code>Map&lt;K, V&gt;</code> type.</p>
  
  <p>How are we supposed to use <code>ReadonlyMap&lt;K, V&gt;</code> in our code?</p>
  
  <p>It's not derived from anything and doesn't declare constructor. So, is it true that we just should do:</p>
  
  <pre><code>public publicApiMethod(): ReadonlyMap&lt;K, V&gt; {
      const map: Map&lt;K, V&gt; = new Map(...);
      return map as ReadonlyMap&lt;K, V&gt;;
  }
  </code></pre>
  
  <p>Or there are a better approaches to using <code>ReadonlyMap&lt;K, V&gt;</code> rather than just typecasting?</p>