function add(obj, key, val) {
  if (obj !== null && key in obj) {
    throw new Error(`The object already contains the key "${key}"`);
  }
  set(obj, key, val);
}
Adds a key-value pair to the object. Throws an exception if the key is
already in use. Use set if you want to change an existing pair.
@param {?Object<K,V>} obj The object to which to add the key-value pair.
@param {string} key The key to add.
@param {V} val The value to add.
@return {void}
@template K,V