typeMapSet = (transaction, parent, key, value) => {
  const left = parent._map.get(key) || null;
  const doc = transaction.doc;
  const ownClientId = doc.clientID;
  let content;

  if (value == null) {
    content = new ContentAny([value]);
  } else {
    switch (value.constructor) {
      case Number:
      case Object:
      case Boolean:
      case Array:
      case String:
        content = new ContentAny([value]);
        break;

      case Uint8Array:
        content = new ContentBinary(
        /** @type {Uint8Array} */
        value);
        break;

      case Doc:
        content = new ContentDoc(
        /** @type {Doc} */
        value);
        break;

      default:
        if (value instanceof AbstractType) {
          content = new ContentType(value);
        } else {
          throw new Error('Unexpected content type');
        }

    }
  }

  new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, null, null, parent, key, content).integrate(transaction, 0);
}
@param {Transaction} transaction
@param {AbstractType<any>} parent
@param {string} key
@param {Object|number|null|Array<any>|string|Uint8Array|AbstractType<any>} value

@private
@function