Skip to content

Commit

Permalink
Improve type infererence for Map
Browse files Browse the repository at this point in the history
  • Loading branch information
A0150315 authored and tanjianqing committed Jun 27, 2022
1 parent 8d12d4e commit 678584e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion type-definitions/immutable.d.ts
Expand Up @@ -759,7 +759,9 @@ declare namespace Immutable {
* but since Immutable Map keys can be of any type the argument to `get()` is
* not altered.
*/
function Map<V>(obj: V): Map<keyof V, V[keyof V]>;
function Map<V>(obj: V): (V extends Map<unknown, unknown>
? V
: Map<keyof V, V[keyof V]>);

interface Map<K, V> extends Collection.Keyed<K, V> {
/**
Expand Down

0 comments on commit 678584e

Please sign in to comment.