'Map putall equivalent method in typescript Map

Problem Statement: Wanted to combine Map B to Map A in typescript without changing reference of Map A

Doing below changes the reference of first Map

const MapA: Map<string, string> = new Map([...MapA, ...MapB]);

I tried searching, but couldn't find any equivalent method on typescript to put all entries of one map



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source