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

Code before:
    else messagePayload = MessagePayload.create(this, options);

    const { body: data, files } = await messagePayload.resolveBody().resolveFiles();

    const response = await this.client.rest.post(Routes.interactionCallback(this.id, this.token), {
      body: {
        type: InteractionResponseType.UpdateMessage,
        data,
      },
      files,
      auth: false,
      query: makeURLSearchParams({ with_response: options.withResponse ?? false }),
    });
    this.replied = true;

    return options.withResponse
      ? new InteractionCallbackResponse(this.client, response)
      : new InteractionResponse(this, this.message.interaction?.id);
  }

  /**
   * Shows a modal component
   * @param {ModalBuilder|ModalComponentData|APIModalInteractionResponseCallbackData} modal The modal to show
   * @param {ShowModalOptions} [options={}] The options for sending this interaction response
   * @returns {Promise<InteractionCallbackResponse|undefined>}
   */
  async showModal(modal, options = {}) {
    if (this.deferred || this.replied) throw new DiscordjsError(ErrorCodes.InteractionAlreadyReplied);
    const response = await this.client.rest.post(Routes.interactionCallback(this.id, this.token), {
      body: {
        type: InteractionResponseType.Modal,
        data: isJSONEncodable(modal) ? modal.toJSON() : this.client.options.jsonTransformer(modal),
      },
      auth: false,
      query: makeURLSearchParams({ with_response: options.withResponse ?? false }),
    });
    this.replied = true;

    return options.withResponse ? new InteractionCallbackResponse(this.client, response) : undefined;
  }

  /**
   * An object containing the same properties as {@link CollectorOptions}, but a few less:
   * @typedef {Object} AwaitModalSubmitOptions
   * @property {CollectorFilter} [filter] The filter applied to this collector
   * @property {number} time Time in milliseconds to wait for an interaction before rejecting
   */

  /**
   * Collects a single modal submit interaction that passes the filter.
   * The Promise will reject if the time expires.

Review comment (suggestion):
The return type `undefined` needs reflecting in the typings. Currently, it's `void`.

Code after:
    if (options instanceof MessagePayload) messagePayload = options;
    else messagePayload = MessagePayload.create(this, options);

    const { body: data, files } = await messagePayload.resolveBody().resolveFiles();

    const response = await this.client.rest.post(Routes.interactionCallback(this.id, this.token), {
      body: {
        type: InteractionResponseType.UpdateMessage,
        data,
      },
      files,
      auth: false,
      query: makeURLSearchParams({ with_response: options.withResponse ?? false }),
    });
    this.replied = true;

    return options.withResponse
      ? new InteractionCallbackResponse(this.client, response)
      : new InteractionResponse(this, this.message.interaction?.id);
  }

  /**
   * Shows a modal component
   * @param {ModalBuilder|ModalComponentData|APIModalInteractionResponseCallbackData} modal The modal to show
   * @param {ShowModalOptions} [options={}] The options for sending this interaction response
   * @returns {Promise<InteractionCallbackResponse|undefined>}
   */
  async showModal(modal, options = {}) {
    if (this.deferred || this.replied) throw new DiscordjsError(ErrorCodes.InteractionAlreadyReplied);
    const response = await this.client.rest.post(Routes.interactionCallback(this.id, this.token), {
      body: {
        type: InteractionResponseType.Modal,
        data: isJSONEncodable(modal) ? modal.toJSON() : this.client.options.jsonTransformer(modal),
      },
      auth: false,
      query: makeURLSearchParams({ with_response: options.withResponse ?? false }),
    });
    this.replied = true;

    return options.withResponse ? new InteractionCallbackResponse(this.client, response) : undefined;
  }

  /**
   * An object containing the same properties as {@link CollectorOptions}, but a few less:
   * @typedef {Object} AwaitModalSubmitOptions
   * @property {CollectorFilter} [filter] The filter applied to this collector
   * @property {number} time Time in milliseconds to wait for an interaction before rejecting
   */

  /**
   * Collects a single modal submit interaction that passes the filter.