Add indexers to a JS Map
https://stackoverflow.com/questions/55801034/whats-the-difference-between-mapstring-myobject-and-index-string-myobje/55808606#comment98302027_55808606
by Ben Smith
TypeScript
const map = new Map<string, number>();
// Set the value of "a" using Map's set function
map.set("a", 123);
const handler = {
get: (target: Map<string, number>, name: string) => { return target.get(name)},
set: (target: Map<string, number>, name: string, value: number) => {target.set(name, value)}
};
const mapWrapper = new Proxy(map, handler);
console.log(mapWrapper["a"]);
// Now add "b" to the Map with the value of 321 via the Proxy wrapper
mapWrapper["b"] = 321;
console.log(mapWrapper["b"]);