Repository: discordjs/discord.js
File: packages/discord.js/src/structures/Role.js (JavaScript)

Code before:
          : this.rawPosition > role.rawPosition),
      0,
    );
  }

  /**
   * Compares this role's position to another role's.
   *
   * @param {RoleResolvable} role Role to compare to this one
   * @returns {number} Negative number if this role's position is lower (other role's is higher),
   * positive number if this one is higher (other's is lower), 0 if equal
   * @example
   * // Compare the position of a role to another
   * const roleCompare = role.comparePositionTo(otherRole);
   * if (roleCompare >= 1) console.log(`${role.name} is higher than ${otherRole.name}`);
   */
  comparePositionTo(role) {
    return this.guild.roles.comparePositions(this, role);
  }

  /**
   * The data for a role.
   *
   * @typedef {Object} RoleData
   * @property {string} [name] The name of the role
   * @property {RoleColors} [colors] The colors of the role
   * @property {boolean} [hoist] Whether or not the role should be hoisted
   * @property {number} [position] The position of the role
   * @property {PermissionResolvable} [permissions] The permissions of the role
   * @property {boolean} [mentionable] Whether or not the role should be mentionable
   * @property {?(BufferResolvable|Base64Resolvable|EmojiResolvable)} [icon] The icon for the role
   * <warn>The `EmojiResolvable` should belong to the same guild as the role.
   * If not, pass the emoji's URL directly</warn>
   * @property {?string} [unicodeEmoji] The unicode emoji for the role
   */

  /**
   * Edits the role.
   *
   * @param {RoleEditOptions} options The options to provide
   * @returns {Promise<Role>}
   * @example
   * // Edit a role
   * role.edit({ name: 'new role' })
   *   .then(updated => console.log(`Edited role name to ${updated.name}`))
   *   .catch(console.error);
   */
  async edit(options) {
    return this.guild.roles.edit(this, options);
  }


Review comment (suggestion):
```suggestion
   * @property {RoleColorsResolvable} [colors] The colors of the role
```

Code after:
   *
   * @type {number}
   * @readonly
   */
  get position() {
    return this.guild.roles.cache.reduce(
      (acc, role) =>
        acc +
        (this.rawPosition === role.rawPosition
          ? BigInt(this.id) < BigInt(role.id)
          : this.rawPosition > role.rawPosition),
      0,
    );
  }

  /**
   * Compares this role's position to another role's.
   *
   * @param {RoleResolvable} role Role to compare to this one
   * @returns {number} Negative number if this role's position is lower (other role's is higher),
   * positive number if this one is higher (other's is lower), 0 if equal
   * @example
   * // Compare the position of a role to another
   * const roleCompare = role.comparePositionTo(otherRole);
   * if (roleCompare >= 1) console.log(`${role.name} is higher than ${otherRole.name}`);
   */
  comparePositionTo(role) {
    return this.guild.roles.comparePositions(this, role);
  }

  /**
   * The data for a role.
   *
   * @typedef {Object} RoleData
   * @property {string} [name] The name of the role
   * @property {RoleColorsResolvable} [colors] The colors of the role
   * @property {boolean} [hoist] Whether or not the role should be hoisted
   * @property {number} [position] The position of the role
   * @property {PermissionResolvable} [permissions] The permissions of the role
   * @property {boolean} [mentionable] Whether or not the role should be mentionable
   * @property {?(BufferResolvable|Base64Resolvable|EmojiResolvable)} [icon] The icon for the role
   * <warn>The `EmojiResolvable` should belong to the same guild as the role.
   * If not, pass the emoji's URL directly</warn>
   * @property {?string} [unicodeEmoji] The unicode emoji for the role
   */

  /**
   * Edits the role.
   *
   * @param {RoleEditOptions} options The options to provide
   * @returns {Promise<Role>}