Description
🔎 Search Terms
"No overload matches this call" '(iterable?: Iterable<readonly [unknown, unknown]> | null | undefined): Map<unknown, unknown>'
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about this.
⏯ Playground Link
💻 Code
const input = new Map([ ['apple','red'], ['banana','yellow'] ]);
new Map([...input].map(entry => entry.reverse()));
🙁 Actual behavior
compile error:
No overload matches this call.
Overload 1 of 4, '(iterable?: Iterable<readonly [unknown, unknown]> | null | undefined): Map<unknown, unknown>', gave the following error.
Argument of type 'string[][]' is not assignable to parameter of type 'Iterable<readonly [unknown, unknown]>'.
The types returned by 'Symbol.iterator.next(...)' are incompatible between these types.
Type 'IteratorResult<string[], any>' is not assignable to type 'IteratorResult<readonly [unknown, unknown], any>'.
Type 'IteratorYieldResult<string[]>' is not assignable to type 'IteratorResult<readonly [unknown, unknown], any>'.
Type 'IteratorYieldResult<string[]>' is not assignable to type 'IteratorYieldResult<readonly [unknown, unknown]>'.
Type 'string[]' is not assignable to type 'readonly [unknown, unknown]'.
Target requires 2 element(s) but source may have fewer.
Overload 2 of 4, '(entries?: readonly (readonly [unknown, unknown])[] | null | undefined): Map<unknown, unknown>', gave the following error.
Argument of type 'string[][]' is not assignable to parameter of type 'readonly (readonly [unknown, unknown])[]'.
Type 'string[]' is not assignable to type 'readonly [unknown, unknown]'.
🙂 Expected behavior
No compile error
Additional information about the issue
This JavaScript code has no compile error at https://developer.mozilla.org/en-US/play .
i.e. It works.