<ul class="contains-task-list">
<li class="task-list-item">
<p dir="auto"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I want to talk about <code class="notranslate">jquery/jquery.d.ts</code>.</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/borisyankov/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/borisyankov">@borisyankov</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/choffmeister/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/choffmeister">@choffmeister</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/Steve-Fenton/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/Steve-Fenton">@Steve-Fenton</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/Diullei/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/Diullei">@Diullei</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/tasoili/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/tasoili">@tasoili</a> @jasons-novaleaf <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/seanski/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/seanski">@seanski</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/Guuz/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/Guuz">@Guuz</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/ksummerlin/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/ksummerlin">@ksummerlin</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/basarat/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/basarat">@basarat</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/nwolverson/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/nwolverson">@nwolverson</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/derekcicerone/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/derekcicerone">@derekcicerone</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/AndrewGaspar/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/AndrewGaspar">@AndrewGaspar</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/jameshfisher/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/jameshfisher">@jameshfisher</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/seikichi/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/seikichi">@seikichi</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/benjaminjackman/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/benjaminjackman">@benjaminjackman</a>  <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/JoshStrobl/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/JoshStrobl">@JoshStrobl</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/johnnyreilly/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/johnnyreilly">@johnnyreilly</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/DickvdBrink/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/DickvdBrink">@DickvdBrink</a></li>
</ul>
</li>
<li class="task-list-item">
<p dir="auto"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I want to talk about <code class="notranslate">jquery.dataTables/jquery.dataTables.d.ts</code>.</p>
<ul dir="auto">
<li>The authors of that type definition are cc/ <a class="user-mention notranslate" data-hovercard-type="organization" data-hovercard-url="/orgs/Silver-Connection/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/Silver-Connection">@Silver-Connection</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/omidkrad/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/omidkrad">@omidkrad</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/pragmatrix/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/pragmatrix">@pragmatrix</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/CNBoland/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/CNBoland">@CNBoland</a></li>
</ul>
</li>
</ul>
<hr>
<p dir="auto">The static property<code class="notranslate">JQueryStatic.fn</code> (AKA <code class="notranslate">jQuery.fn</code> or <code class="notranslate">$.fn</code>) is declared as <code class="notranslate">any</code> which makes it impossible for plugin authors to write proper type declarations.</p>
<p dir="auto">An example of such a plugin is the DataTables plugin, which has a handful of static functions that you can access via <code class="notranslate">$.fn.dataTables</code>.</p>
<p dir="auto">In jquery/jquery.d.ts</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="fn: any;  //TODO: Decide how we want to type this"><pre class="notranslate">fn: <span class="pl-s1">any</span><span class="pl-kos">;</span>  <span class="pl-c">//TODO: Decide how we want to type this</span></pre></div>
<p dir="auto">In jquery.dataTables/jquery.dataTables.d.ts</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="//TODO: Wrong, as jquery.d.ts has no interface for fn
//interface JQueryStatic {
//    dataTable: DataTables.StaticFunctions;
//}"><pre class="notranslate"><span class="pl-c">//TODO: Wrong, as jquery.d.ts has no interface for fn</span>
<span class="pl-c">//interface JQueryStatic {</span>
<span class="pl-c">//    dataTable: DataTables.StaticFunctions;</span>
<span class="pl-c">//}</span></pre></div>
<p dir="auto"><a href="https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/jquery/jquery.d.ts#L966">https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/jquery/jquery.d.ts#L966</a><br>
<a href="https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/jquery.dataTables/jquery.dataTables.d.ts#L17-L20">https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/jquery.dataTables/jquery.dataTables.d.ts#L17-L20</a></p>
<p dir="auto">Example: <a href="https://datatables.net/reference/api/$.fn.dataTable.tables()" rel="nofollow">https://datatables.net/reference/api/$.fn.dataTable.tables()</a></p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// get all DataTables on the page.
let tables: DataTables.DataTable[] = $.fn.dataTables.tables() as DataTables.DataTable[];"><pre class="notranslate"><span class="pl-c">// get all DataTables on the page.</span>
<span class="pl-k">let</span> <span class="pl-s1">tables</span>: <span class="pl-smi">DataTables</span><span class="pl-kos">.</span><span class="pl-smi">DataTable</span><span class="pl-kos">[</span><span class="pl-kos">]</span> <span class="pl-c1">=</span> <span class="pl-s1">$</span><span class="pl-kos">.</span><span class="pl-c1">fn</span><span class="pl-kos">.</span><span class="pl-c1">dataTables</span><span class="pl-kos">.</span><span class="pl-en">tables</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-k">as</span> <span class="pl-smi">DataTables</span><span class="pl-kos">.</span><span class="pl-smi">DataTable</span><span class="pl-kos">[</span><span class="pl-kos">]</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">Here, the inferred return type of <code class="notranslate">tables()</code> is <code class="notranslate">any</code> because the type of <code class="notranslate">fn</code> is <code class="notranslate">any</code>, but the actual return type is an array of <code class="notranslate">DataTable</code>.</p>
<p dir="auto">I have an issue during writing a piece of declaration for existing node.js module - bluebird.js. The module has a method named <code class="notranslate">props</code> which gets an object has promises in it then return an object have same property names. It seems like object-version <code class="notranslate">map</code>. I wanted to add types for that.</p>
<p dir="auto">For <code class="notranslate">all</code> I can easily get the types like</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="  static all&lt;T1, T2&gt;(values: [Promise.Thenable&lt;T1&gt;, Promise.Thenable&lt;T2&gt;]): Promise&lt;[T1, T2]&gt;;
  static all&lt;T1, T2, T3&gt;(values: [Promise.Thenable&lt;T1&gt;, Promise.Thenable&lt;T2&gt;, Promise.Thenable&lt;T3&gt;]): Promise&lt;[T1, T2, T3]&gt;;
  // ..."><pre class="notranslate">  <span class="pl-s1">static</span> <span class="pl-s1">all</span><span class="pl-c1">&lt;</span><span class="pl-smi">T1</span><span class="pl-kos">,</span> <span class="pl-smi">T2</span><span class="pl-c1">&gt;</span><span class="pl-kos">(</span><span class="pl-s1">values</span>: <span class="pl-kos">[</span><span class="pl-smi">Promise</span><span class="pl-kos">.</span><span class="pl-smi">Thenable</span><span class="pl-kos">&lt;</span><span class="pl-smi">T1</span><span class="pl-kos">&gt;</span><span class="pl-kos">,</span> <span class="pl-smi">Promise</span><span class="pl-kos">.</span><span class="pl-smi">Thenable</span><span class="pl-kos">&lt;</span><span class="pl-smi">T2</span><span class="pl-kos">&gt;</span><span class="pl-kos">]</span><span class="pl-kos">)</span>: <span class="pl-smi">Promise</span><span class="pl-kos">&lt;</span><span class="pl-kos">[</span><span class="pl-smi">T1</span><span class="pl-kos">,</span> <span class="pl-smi">T2</span><span class="pl-kos">]</span><span class="pl-kos">&gt;</span><span class="pl-kos">;</span>
  <span class="pl-k">static</span> <span class="pl-smi">all</span><span class="pl-kos">&lt;</span><span class="pl-smi">T1</span><span class="pl-kos">,</span> <span class="pl-smi">T2</span><span class="pl-kos">,</span> <span class="pl-smi">T3</span><span class="pl-kos">&gt;</span><span class="pl-kos">(</span><span class="pl-s1">values</span>: <span class="pl-kos">[</span><span class="pl-smi">Promise</span><span class="pl-kos">.</span><span class="pl-smi">Thenable</span><span class="pl-kos">&lt;</span><span class="pl-smi">T1</span><span class="pl-kos">&gt;</span><span class="pl-kos">,</span> <span class="pl-smi">Promise</span><span class="pl-kos">.</span><span class="pl-smi">Thenable</span><span class="pl-kos">&lt;</span><span class="pl-smi">T2</span><span class="pl-kos">&gt;</span><span class="pl-kos">,</span> <span class="pl-smi">Promise</span><span class="pl-kos">.</span><span class="pl-smi">Thenable</span><span class="pl-kos">&lt;</span><span class="pl-smi">T3</span><span class="pl-kos">&gt;</span><span class="pl-kos">]</span><span class="pl-kos">)</span>: <span class="pl-smi">Promise</span><span class="pl-kos">&lt;</span><span class="pl-kos">[</span><span class="pl-smi">T1</span><span class="pl-kos">,</span> <span class="pl-smi">T2</span><span class="pl-kos">,</span> <span class="pl-smi">T3</span><span class="pl-kos">]</span><span class="pl-kos">&gt;</span><span class="pl-kos">;</span>
  <span class="pl-c">// ...</span></pre></div>
<p dir="auto">But for <code class="notranslate">props</code> the other hand,</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="  static props&lt;T1&gt;(object: {[k:string]: Promise.Thenable&lt;T1&gt;}): Promise&lt;{[k:string]: T1}&gt;;"><pre class="notranslate">  <span class="pl-s1">static</span> <span class="pl-s1">props</span><span class="pl-c1">&lt;</span><span class="pl-smi">T1</span><span class="pl-c1">&gt;</span><span class="pl-kos">(</span><span class="pl-s1">object</span>: <span class="pl-kos">{</span><span class="pl-kos">[</span><span class="pl-s1">k</span>:<span class="pl-smi">string</span><span class="pl-kos">]</span>: <span class="pl-smi">Promise</span><span class="pl-kos">.</span><span class="pl-smi">Thenable</span><span class="pl-kos">&lt;</span><span class="pl-smi">T1</span><span class="pl-kos">&gt;</span><span class="pl-kos">}</span><span class="pl-kos">)</span>: <span class="pl-smi">Promise</span><span class="pl-kos">&lt;</span><span class="pl-kos">{</span><span class="pl-kos">[</span><span class="pl-s1">k</span>:<span class="pl-smi">string</span><span class="pl-kos">]</span>: <span class="pl-smi">T1</span><span class="pl-kos">}</span><span class="pl-kos">&gt;</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">I'm getting this</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="bluebird/bluebird-tests.ts(530,10): error TS2339: Property 'foo' does not exist on type '{ [k: string]: Foo; }'.
bluebird/bluebird-tests.ts(534,10): error TS2339: Property 'bar' does not exist on type '{ [k: string]: Bar; }'."><pre class="notranslate"><code class="notranslate">bluebird/bluebird-tests.ts(530,10): error TS2339: Property 'foo' does not exist on type '{ [k: string]: Foo; }'.
bluebird/bluebird-tests.ts(534,10): error TS2339: Property 'bar' does not exist on type '{ [k: string]: Bar; }'.
</code></pre></div>
<p dir="auto">Is there any tip for issue like this?</p>