<p dir="auto">The interface ObjectIterator has an optional <code class="notranslate">key</code> parameter. This becomes an issue when trying to use the key in a context with StrictNullChecking enabled. For example, the mapValues() function use ObjectIterator as its callback function:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="mapValues(dict, (value, key) =&gt; {
  // This line throws an error because the key can be undefined
  dict[key];
  if (key) {
    // This line is OK
    dict[key];
  }
});"><pre class="notranslate"><span class="pl-en">mapValues</span><span class="pl-kos">(</span><span class="pl-s1">dict</span><span class="pl-kos">,</span> <span class="pl-kos">(</span><span class="pl-s1">value</span><span class="pl-kos">,</span> <span class="pl-s1">key</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
  <span class="pl-c">// This line throws an error because the key can be undefined</span>
  <span class="pl-s1">dict</span><span class="pl-kos">[</span><span class="pl-s1">key</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
  <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-s1">key</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-c">// This line is OK</span>
    <span class="pl-s1">dict</span><span class="pl-kos">[</span><span class="pl-s1">key</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">It does not makes sense to check the key for nulls while iterating a dictionary because it cannot exists values in the dictionary that does not have any keys.</p>
<p dir="auto">I suggest we change the type of the <code class="notranslate">key</code> parameter in the interface ObjectIterator from <code class="notranslate">key?: string</code> to <code class="notranslate">key: string</code>. Maybe this applies for other iterator interfaces as well such as NumericDictionaryIterator and DictionaryIterator. Any comments/objections?</p>
<ul dir="auto">
<li>The authors of that type definition are cc/ <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/bczengel/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/bczengel">@bczengel</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/chrootsu/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/chrootsu">@chrootsu</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/stepancar/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/stepancar">@stepancar</a></li>
</ul>
<ul dir="auto">
<li>[x ] I tried using the latest <code class="notranslate">materialize-css/index.d.ts</code> file in this repo and had problems.</li>
</ul>
<p dir="auto">Hi,</p>
<p dir="auto">I use materialize-css and angular2-materialize directives. I couldn't use the global object <code class="notranslate">Materialize</code> because of <code class="notranslate">Cannot find name Materialize</code>. I was glad to find out the definition here so I installed it.<br>
The problem now is that I have a lot of <code class="notranslate">Duplicate identifier</code> coming from the jQuery type dependency.<br>
I inspected the directories :</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@types 
    materialize-css
        index.d.ts
        node_modules 
            @types 
                jquery
    pickadate 
        index.d.ts
        node_modules 
            @types 
                jquery"><pre class="notranslate"><code class="notranslate">@types 
    materialize-css
        index.d.ts
        node_modules 
            @types 
                jquery
    pickadate 
        index.d.ts
        node_modules 
            @types 
                jquery
</code></pre></div>
<p dir="auto">As you can see, materialize-css installs <code class="notranslate">@types/jquery</code>, but also <code class="notranslate">pickadate</code> which itself installs <code class="notranslate">@types/jquery</code>, leading to that <code class="notranslate">Duplicate identifier issue</code>.<br>
I am on Typescript 2.0.9 and I tried to exlude the directory <code class="notranslate">node_modules/materialize-css/node_modules</code> but it didn't work.<br>
Can you help me ?</p>
<p dir="auto">Thx</p>