Closed
Description
Regression in 4.1, found in adone on DT.
declare class DMap<K, V> {
constructor(iterable: Iterable<[K, V]> | undefined);
}
new DMap([["1", 2]])
Expected behavior:
K=string, V=number, no error
Actual behavior:
K=string | number, V=string | number, "(string | number)[][] is not assignable to to parameter of type Iterable<[string | number, string | number]>."
Removing undefined
makes inference work; the actual workaround I used for adone was to split a constructor with optional parameters into 3 overloads.