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

Code before:
       * Whether the user is an Official Discord System user (part of the urgent message system)
       *
       * @type {?boolean}
       */
      this.system = Boolean(data.system);
    } else if (!this.partial && typeof this.system !== 'boolean') {
      this.system = false;
    }

    if ('public_flags' in data) {
      /**
       * The flags for this user
       *
       * @type {?UserFlagsBitField}
       */
      this.flags = new UserFlagsBitField(data.public_flags);
    }

    /**
     * @typedef {Object} AvatarDecorationData
     * @property {string} asset The avatar decoration hash
     * @property {Snowflake} skuId The id of the avatar decoration's SKU
     */

    if ('avatar_decoration_data' in data) {
      /**
       * The user avatar decoration's data
       *
       * @type {?AvatarDecorationData}
       */
      this.avatarDecorationData = {
        asset: data.avatar_decoration_data?.asset,
        skuId: data.avatar_decoration_data?.sku_id,
      };
    } else {
      this.avatarDecorationData ??= null;
    }

    /**
     * @typedef {Object} UserPrimaryGuild
     * @property {?Snowflake} identityGuildId - The id of the user's primary guild
     * @property {?boolean} identityEnabled - Whether the user is displaying the primary guild's tag
     * @property {?string} tag - The user's guild tag. Limited to 4 characters
     * @property {?string} badge - The guild tag badge hash
     */

    if ('primary_guild' in data) {
      /**
       * The primary guild of the user
       *
       * @type {?UserPrimaryGuild}

Review comment (suggestion):
This will now cause a payload of `{avatar_decoration_data: null}` to cause `User#avatarDecorationData` to be `{asset: undefined, skuId: undefined}` which is not valid according to the types. So should probably keep both the `in` check and the `value is falsey`.

Code after:
      /**
       * Whether the user is an Official Discord System user (part of the urgent message system)
       *
       * @type {?boolean}
       */
      this.system = Boolean(data.system);
    } else if (!this.partial && typeof this.system !== 'boolean') {
      this.system = false;
    }

    if ('public_flags' in data) {
      /**
       * The flags for this user
       *
       * @type {?UserFlagsBitField}
       */
      this.flags = new UserFlagsBitField(data.public_flags);
    }

    /**
     * @typedef {Object} AvatarDecorationData
     * @property {string} asset The avatar decoration hash
     * @property {Snowflake} skuId The id of the avatar decoration's SKU
     */

    if ('avatar_decoration_data' in data) {
      if (data.avatar_decoration_data) {
        /**
         * The user avatar decoration's data
         *
         * @type {?AvatarDecorationData}
         */
        this.avatarDecorationData = {
          asset: data.avatar_decoration_data.asset,
          skuId: data.avatar_decoration_data.sku_id,
        };
      } else {
        this.avatarDecorationData = null;
      }
    } else {
      this.avatarDecorationData ??= null;
    }

    /**
     * @typedef {Object} NameplateData
     * @property {Snowflake} skuId The id of the nameplate's SKU
     * @property {string} asset The nameplate's asset path
     * @property {string} label The nameplate's label
     * @property {NameplatePalette} palette Background color of the nameplate
     */