feat: add constructors without type arguments.

As the constructed objects have an any type, the
resulting containers are assignable to any type:

    var x: Map<string, number> = new Map();

That is useful to avoid having to specify types
twice when declaration and assignment are in
different places.
This commit is contained in:
Martin Probst 2015-06-17 21:36:42 -07:00
parent 58b38c9201
commit 35e882e74f
1 changed files with 2 additions and 0 deletions

View File

@ -45,6 +45,7 @@ interface Map<K, V> {
size: number;
}
declare var Map: {
new (): Map<any, any>;
new<K, V>(): Map<K, V>;
// alexeagle: PATCHED
new<K, V>(m: Map<K, V>): Map<K, V>;
@ -61,6 +62,7 @@ interface Set<T> {
size: number;
}
declare var Set: {
new (): Set<any>;
new<T>(): Set<T>;
// alexeagle PATCHED
new<T>(s: Set<T>): Set<T>;