import { IMap, INumberMap } from "./interfaces"; import { extend } from "./extend"; export function add(map: IMap, newKey: string, newVal: TVal): IMap; export function add(map: INumberMap, newKey: number, newVal: TVal): INumberMap; export function add(map: IMap, newKey: string | number, newVal: TVal): IMap { const newMap = extend(map); newMap[newKey] = newVal; return newMap; }