<p dir="auto">The constructor for an ES6 Set takes an optional iterable parameter (<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set" rel="nofollow">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set</a>) but the declaration in <code class="notranslate">lib.d.ts</code> doesn't include it</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="declare var Set: {
    new &lt;T&gt;(): Set&lt;T&gt;;
}"><pre class="notranslate"><code class="notranslate">declare var Set: {
    new &lt;T&gt;(): Set&lt;T&gt;;
}
</code></pre></div>
<p dir="auto">So I'm getting a Typescript error if I try to do something like <code class="notranslate">new Set([1,2,3])</code>.</p>
<p dir="auto">On a somewhat related note I'm using the 1.5 Beta version of typescript which supports a lot of ES6 features but it still relies on the browser to support Sets. Are there plans polyfill Sets in Typescript?</p>
<p dir="auto">Hello, I read <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="38941980" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/280" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/280/hovercard" href="https://github.com/microsoft/TypeScript/issues/280">#280</a> &amp; <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="45241754" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/857" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/857/hovercard" href="https://github.com/microsoft/TypeScript/issues/857">#857</a> and I'm still confused how can I extend an ambient module. Honestly I'm able to extend it neither nice way nor any other way :-(.<br>
Let's say I have a library I wanna extend. It's not my library, I cannot touch it. It's written in javaScript, so I have .d.ts file for it, e.g.:<br>
<strong>AmbientModule.d.ts</strong>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="declare module AmbientModule {
     export interface SomeInterface {
        someField?: string;
     }

     export function DoSomething(a: SomeInterface): void;
     export function DoSomethingElse(): void;
}"><pre class="notranslate"><code class="notranslate">declare module AmbientModule {
     export interface SomeInterface {
        someField?: string;
     }

     export function DoSomething(a: SomeInterface): void;
     export function DoSomethingElse(): void;
}
</code></pre></div>
<p dir="auto">I wanna add a new field to the <code class="notranslate">SomeInterface</code> interface. Not just some random field, but field of my type. Here's my extension:<br>
<strong>Extension.ts</strong>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/// &lt;reference path=&quot;AmbientModule.d.ts&quot;/&gt;
//import am = require(&quot;AmbientModule&quot;);

import SomeInterface = AmbientModule.SomeInterface;

export module Extension {
    export interface ExtData {
        someData?: Number;
    }

    export function MyFunction(): void {
        AmbientModule.DoSomethingElse();
        var x: SomeInterface = { someField: &quot;sf&quot;, additionalFiled: { someData: 7 } };
    }
}

declare module AmbientModule {
    export interface SomeInterface {
        additionalFiled?: Extension.ExtData;
    }
}"><pre class="notranslate"><code class="notranslate">/// &lt;reference path="AmbientModule.d.ts"/&gt;
//import am = require("AmbientModule");

import SomeInterface = AmbientModule.SomeInterface;

export module Extension {
    export interface ExtData {
        someData?: Number;
    }

    export function MyFunction(): void {
        AmbientModule.DoSomethingElse();
        var x: SomeInterface = { someField: "sf", additionalFiled: { someData: 7 } };
    }
}

declare module AmbientModule {
    export interface SomeInterface {
        additionalFiled?: Extension.ExtData;
    }
}
</code></pre></div>
<p dir="auto">As you can see I also wanna use the extended interface in the extension itself.<br>
This is the consumer of the extended library:<br>
<strong>Consumer.ts</strong>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/// &lt;reference path=&quot;AmbientModule.d.ts&quot;/&gt;
//import amb = require(&quot;AmbientModule&quot;);
import ext = require(&quot;Extension&quot;);

function main() {
    AmbientModule.DoSomething({
        someField: &quot;aaa&quot;,
        additionalFiled: { someData: 7 }
    });
}"><pre class="notranslate"><code class="notranslate">/// &lt;reference path="AmbientModule.d.ts"/&gt;
//import amb = require("AmbientModule");
import ext = require("Extension");

function main() {
    AmbientModule.DoSomething({
        someField: "aaa",
        additionalFiled: { someData: 7 }
    });
}
</code></pre></div>
<p dir="auto">For completenes, I have _global.ts<br>
<strong>_global.ts</strong>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="declare module 'AmbientModule' { }"><pre class="notranslate"><code class="notranslate">declare module 'AmbientModule' { }
</code></pre></div>
<p dir="auto">When I try to compile this I get bunch of errors:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TS2322  Type '{ someField: string; additionalFiled: { someData: number; }; }' is not assignable to type 'SomeInterface'.
  Object literal may only specify known properties, and 'someField' does not exist in type 'SomeInterface'. Extension.ts 13
TS2345  Argument of type '{ someField: string; additionalFiled: { someData: number; }; }' is not assignable to parameter of type 'SomeInterface'.
  Object literal may only specify known properties, and 'additionalFiled' does not exist in type 'SomeInterface'.   Consumer.ts 8
Build: Argument of type '{ someField: string; additionalFiled: { someData: number; }; }' is not assignable to parameter of type 'SomeInterface'.    Consumer.ts 8   
Build: Type '{ someField: string; additionalFiled: { someData: number; }; }' is not assignable to type 'SomeInterface'. Extension.ts    13  "><pre class="notranslate"><code class="notranslate">TS2322  Type '{ someField: string; additionalFiled: { someData: number; }; }' is not assignable to type 'SomeInterface'.
  Object literal may only specify known properties, and 'someField' does not exist in type 'SomeInterface'. Extension.ts 13
TS2345  Argument of type '{ someField: string; additionalFiled: { someData: number; }; }' is not assignable to parameter of type 'SomeInterface'.
  Object literal may only specify known properties, and 'additionalFiled' does not exist in type 'SomeInterface'.   Consumer.ts 8
Build: Argument of type '{ someField: string; additionalFiled: { someData: number; }; }' is not assignable to parameter of type 'SomeInterface'.    Consumer.ts 8   
Build: Type '{ someField: string; additionalFiled: { someData: number; }; }' is not assignable to type 'SomeInterface'. Extension.ts    13  
</code></pre></div>
<p dir="auto">So, either I'm doing something wring, or this IMO important scenario is not supported.</p>
<p dir="auto">If, you ask why am I doing this. I'm trying to extend the jQuery DataTables library with custom column filtering. For that I need to extend the <code class="notranslate">ColumnSettings</code> interface to add my own per-column configuration.</p>