mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 21:36:50 -05:00
Make Map constructor argument optional and nullable (#43396)
* Make Iterable Map constructor argument optional Fixes #37779 * Change Map constructor in iterable to accept both null and undefined. According to the spec (https://tc39.es/ecma262/#sec-map-iterable), the sole argument passed to Map is allowed to be null or undefined. * Changed Map constructor to ensure new Map() still types as Map<any, any>. * Add map constructor test. This proves that the previous commit fixes #37779, as well as that new Map() still types as Map<any, any>. * Update baseline. Co-authored-by: Jared Neil <jaredneil@lucidchart.com>
This commit is contained in:
committed by
GitHub
parent
7490b329a7
commit
cecd8c50a0
3
src/lib/es2015.iterable.d.ts
vendored
3
src/lib/es2015.iterable.d.ts
vendored
@@ -137,7 +137,8 @@ interface ReadonlyMap<K, V> {
|
||||
}
|
||||
|
||||
interface MapConstructor {
|
||||
new <K, V>(iterable: Iterable<readonly [K, V]>): Map<K, V>;
|
||||
new(): Map<any, any>;
|
||||
new <K, V>(iterable?: Iterable<readonly [K, V]> | null): Map<K, V>;
|
||||
}
|
||||
|
||||
interface WeakMap<K extends object, V> { }
|
||||
|
||||
Reference in New Issue
Block a user