title: Typescript: Usage of Map<> with strictNullChecks
body: <p>Given the following simple class:</p>
  
  <pre><code>class Observer {
          private subscribers: Map&lt;string, Array&lt;((data: any) =&gt; void)&gt;&gt; = new Map();     
  
          public subscribe(event: string, callback: (data: any) =&gt; void) {
              if (!this.subscribers.has(event)) {
                  this.subscribers.set(event, []);
              }
  
              this.subscribers.get(event).push(callback); //tsc says: Object is possibly 'undefined'
          }
      }
  </code></pre>
  
  <p>Furthermore, in tsconfig.json, the flags <code>strictNullChecks</code> and <code>strict</code> are enabled.</p>
  
  <p>Although <code>subscribers</code> is checked for a key of the current event, the typescript compiler complains with the error message shown above (<code>this.subscribers.get(event)</code> is possibly undefined).</p>
  
  <p>If I'm not completely wrong, <code>this.subscribers.get(event)</code> can never be <code>undefined</code> in this case. </p>
  
  <p>How can I get rid of that message?</p>