checkBagEntries = (bagEntries, check) => {
  if (passStyleOf(bagEntries) !== 'copyArray') {
    return check(
      false,
      X`The entries of a copyBag must be a copyArray: ${bagEntries}`,
    );
  }
  if (!isRankSorted(bagEntries, compareAntiRank)) {
    return check(
      false,
      X`The entries of a copyBag must be sorted in reverse rank order: ${bagEntries}`,
    );
  }
  for (const entry of bagEntries) {
    if (
      passStyleOf(entry) !== 'copyArray' ||
      entry.length !== 2 ||
      typeof entry[1] !== 'bigint'
    ) {
      return check(
        false,
        X`Each entry of a copyBag must be pair of a key and a bigint representing a count: ${entry}`,
      );
    }
    if (entry[1] < 1) {
      return check(
        false,
        X`Each entry of a copyBag must have a positive count: ${entry}`,
      );
    }
  }
  // @ts-expect-error XXX Key types
  return checkNoDuplicateKeys(bagEntries, undefined, check);
}
@param {[Passable,bigint][]} bagEntries
@param {Checker} check
@returns {boolean}