Skip to content

Commit

Permalink
docs: remove JSONEncondable
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiralite committed Apr 7, 2023
1 parent 1b9d07f commit 3e61725
Show file tree
Hide file tree
Showing 20 changed files with 48 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,10 @@ class ApplicationCommandManager extends CachedManager {
* @typedef {ApplicationCommand|Snowflake} ApplicationCommandResolvable
*/

/* eslint-disable max-len */
/**
* Data that resolves to the data of an ApplicationCommand
* @typedef {ApplicationCommandData|APIApplicationCommand|JSONEncodable<APIApplicationCommand>} ApplicationCommandDataResolvable
* @typedef {ApplicationCommandData|APIApplicationCommand} ApplicationCommandDataResolvable
*/
/* eslint-enable max-len */

/**
* Options used to fetch data from Discord
Expand Down
2 changes: 1 addition & 1 deletion packages/discord.js/src/managers/GuildStickerManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class GuildStickerManager extends CachedManager {
/**
* Options used to create a guild sticker.
* @typedef {Object} GuildStickerCreateOptions
* @property {BufferResolvable|Stream|JSONEncodable<AttachmentPayload>} file The file for the sticker
* @property {AttachmentPayload|BufferResolvable|Stream} file The file for the sticker
* @property {string} name The name for the sticker
* @property {string} tags The Discord name of a unicode emoji representing the sticker's expression
* @property {?string} [description] The description for the sticker
Expand Down
2 changes: 1 addition & 1 deletion packages/discord.js/src/managers/MessageManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class MessageManager extends CachedManager {
/**
* Options that can be passed to edit a message.
* @typedef {BaseMessageOptions} MessageEditOptions
* @property {Array<JSONEncodable<AttachmentPayload>>} [attachments] An array of attachments to keep,
* @property {AttachmentPayload[]} [attachments] An array of attachments to keep,
* all attachments will be kept if omitted
* @property {MessageFlags} [flags] Which flags to set for the message
* <info>Only the {@link MessageFlags.SuppressEmbeds} flag can be modified.</info>
Expand Down
2 changes: 1 addition & 1 deletion packages/discord.js/src/structures/ActionRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ActionRow extends Component {
* Creates a new action row builder from JSON data
* @method from
* @memberof ActionRow
* @param {JSONEncodable<APIActionRowComponent>|APIActionRowComponent} other The other data
* @param {ActionRowBuilder|ActionRow|APIActionRowComponent} other The other data
* @returns {ActionRowBuilder}
* @deprecated Use {@link ActionRowBuilder.from} instead.
*/
Expand Down
8 changes: 2 additions & 6 deletions packages/discord.js/src/structures/ActionRowBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,11 @@ class ActionRowBuilder extends BuildersActionRow {

/**
* Creates a new action row builder from JSON data
* @param {JSONEncodable<APIActionRowComponent<APIActionRowComponentTypes>>
* |APIActionRowComponent<APIActionRowComponentTypes>} other The other data
* @param {ActionRow|ActionRowBuilder|APIActionRowComponent} other The other data
* @returns {ActionRowBuilder}
*/
static from(other) {
if (isJSONEncodable(other)) {
return new this(other.toJSON());
}
return new this(other);
return new this(isJSONEncodable(other) ? other.toJSON() : other);
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/discord.js/src/structures/AttachmentBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class AttachmentBuilder {

/**
* Makes a new builder instance from a preexisting attachment structure.
* @param {JSONEncodable<AttachmentPayload>} other The builder to construct a new instance from
* @param {AttachmentBuilder|Attachment|AttachmentPayload} other The builder to construct a new instance from
* @returns {AttachmentBuilder}
*/
static from(other) {
Expand Down
7 changes: 2 additions & 5 deletions packages/discord.js/src/structures/ButtonBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,11 @@ class ButtonBuilder extends BuildersButton {

/**
* Creates a new button builder from JSON data
* @param {JSONEncodable<APIButtonComponent>|APIButtonComponent} other The other data
* @param {ButtonBuilder|ButtonComponent|APIButtonComponent} other The other data
* @returns {ButtonBuilder}
*/
static from(other) {
if (isJSONEncodable(other)) {
return new this(other.toJSON());
}
return new this(other);
return new this(isJSONEncodable(other) ? other.toJSON() : other);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,12 @@ class ChannelSelectMenuBuilder extends BuildersChannelSelectMenu {
}

/**
* Creates a new select menu builder from json data
* @param {JSONEncodable<APISelectMenuComponent> | APISelectMenuComponent} other The other data
* Creates a new select menu builder from JSON data
* @param {ChannelSelectMenuBuilder|ChannelSelectMenuComponent|APIChannelSelectComponent} other The other data
* @returns {ChannelSelectMenuBuilder}
*/
static from(other) {
if (isJSONEncodable(other)) {
return new this(other.toJSON());
}
return new this(other);
return new this(isJSONEncodable(other) ? other.toJSON() : other);
}
}

Expand Down
7 changes: 2 additions & 5 deletions packages/discord.js/src/structures/EmbedBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,11 @@ class EmbedBuilder extends BuildersEmbed {

/**
* Creates a new embed builder from JSON data
* @param {JSONEncodable<APIEmbed>|APIEmbed} other The other data
* @param {EmbedBuilder|Embed|APIEmbed} other The other data
* @returns {EmbedBuilder}
*/
static from(other) {
if (isJSONEncodable(other)) {
return new this(other.toJSON());
}
return new this(other);
return new this(isJSONEncodable(other) ? other.toJSON() : other);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@ class MentionableSelectMenuBuilder extends BuildersMentionableSelectMenu {
}

/**
* Creates a new select menu builder from json data
* @param {JSONEncodable<APISelectMenuComponent> | APISelectMenuComponent} other The other data
* Creates a new select menu builder from JSON data
* @param {MentionableSelectMenuBuilder|MentionableSelectMenuComponent|APIMentionableSelectComponent} other
* The other data
* @returns {MentionableSelectMenuBuilder}
*/
static from(other) {
if (isJSONEncodable(other)) {
return new this(other.toJSON());
}
return new this(other);
return new this(isJSONEncodable(other) ? other.toJSON() : other);
}
}

Expand Down
3 changes: 1 addition & 2 deletions packages/discord.js/src/structures/MessagePayload.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ class MessagePayload {

/**
* Resolves a single file into an object sendable to the API.
* @param {BufferResolvable|Stream|JSONEncodable<AttachmentPayload>} fileLike Something that could
* be resolved to a file
* @param {AttachmentPayload|BufferResolvable|Stream} fileLike Something that could be resolved to a file
* @returns {Promise<RawFile>}
*/
static async resolveFile(fileLike) {
Expand Down
7 changes: 2 additions & 5 deletions packages/discord.js/src/structures/ModalBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,11 @@ class ModalBuilder extends BuildersModal {

/**
* Creates a new modal builder from JSON data
* @param {JSONEncodable<APIModalComponent>|APIModalComponent} other The other data
* @param {ModalBuilder|APIModalComponent} other The other data
* @returns {ModalBuilder}
*/
static from(other) {
if (isJSONEncodable(other)) {
return new this(other.toJSON());
}
return new this(other);
return new this(isJSONEncodable(other) ? other.toJSON() : other);
}
}

Expand Down
9 changes: 3 additions & 6 deletions packages/discord.js/src/structures/RoleSelectMenuBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,12 @@ class RoleSelectMenuBuilder extends BuildersRoleSelectMenu {
}

/**
* Creates a new select menu builder from json data
* @param {JSONEncodable<APISelectMenuComponent> | APISelectMenuComponent} other The other data
* Creates a new select menu builder from JSON data
* @param {RoleSelectMenuBuilder|RoleSelectMenuComponent|APIRoleSelectComponent} other The other data
* @returns {RoleSelectMenuBuilder}
*/
static from(other) {
if (isJSONEncodable(other)) {
return new this(other.toJSON());
}
return new this(other);
return new this(isJSONEncodable(other) ? other.toJSON() : other);
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/discord.js/src/structures/StringSelectMenuBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class StringSelectMenuBuilder extends BuildersSelectMenu {

/**
* Normalizes a select menu option emoji
* @param {SelectMenuOptionData|JSONEncodable<APISelectMenuOption>} selectMenuOption The option to normalize
* @param {SelectMenuOptionData|APISelectMenuOption} selectMenuOption The option to normalize
* @returns {SelectMenuOptionBuilder|APISelectMenuOption}
* @private
*/
Expand Down Expand Up @@ -59,7 +59,7 @@ class StringSelectMenuBuilder extends BuildersSelectMenu {

/**
* Creates a new select menu builder from json data
* @param {JSONEncodable<APISelectMenuComponent> | APISelectMenuComponent} other The other data
* @param {StringSelectMenuBuilder|StringSelectMenuComponent|APIStringSelectComponent} other The other data
* @returns {StringSelectMenuBuilder}
*/
static from(other) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,11 @@ class StringSelectMenuOptionBuilder extends BuildersSelectMenuOption {

/**
* Creates a new select menu option builder from JSON data
* @param {JSONEncodable<APISelectMenuOption>|APISelectMenuOption} other The other data
* @param {StringSelectMenuOptionBuilder|APISelectMenuOption} other The other data
* @returns {StringSelectMenuOptionBuilder}
*/
static from(other) {
if (isJSONEncodable(other)) {
return new this(other.toJSON());
}
return new this(other);
return new this(isJSONEncodable(other) ? other.toJSON() : other);
}
}

Expand Down
7 changes: 2 additions & 5 deletions packages/discord.js/src/structures/TextInputBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@ class TextInputBuilder extends BuildersTextInput {

/**
* Creates a new text input builder from JSON data
* @param {JSONEncodable<APITextInputComponent>|APITextInputComponent} other The other data
* @param {TextInputBuilder|TextInputComponent|APITextInputComponent} other The other data
* @returns {TextInputBuilder}
*/
static from(other) {
if (isJSONEncodable(other)) {
return new this(other.toJSON());
}
return new this(other);
return new this(isJSONEncodable(other) ? other.toJSON() : other);
}
}

Expand Down
9 changes: 3 additions & 6 deletions packages/discord.js/src/structures/UserSelectMenuBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,12 @@ class UserSelectMenuBuilder extends BuildersUserSelectMenu {
}

/**
* Creates a new select menu builder from json data
* @param {JSONEncodable<APISelectMenuComponent> | APISelectMenuComponent} other The other data
* Creates a new select menu builder from JSON data
* @param {UserSelectMenuBuilder|UserSelectMenuComponent|APIUserSelectComponent} other The other data
* @returns {UserSelectMenuBuilder}
*/
static from(other) {
if (isJSONEncodable(other)) {
return new this(other.toJSON());
}
return new this(other);
return new this(isJSONEncodable(other) ? other.toJSON() : other);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class TextBasedChannel {
* @property {Embed[]|APIEmbed[]} [embeds] The embeds for the message
* @property {MessageMentionOptions} [allowedMentions] Which mentions should be parsed from the message content
* (see [here](https://discord.com/developers/docs/resources/channel#allowed-mentions-object) for more details)
* @property {Array<JSONEncodable<AttachmentPayload>>|BufferResolvable[]|Attachment[]|AttachmentBuilder[]} [files]
* @property {AttachmentBuilder[]|Attachment[]|AttachmentPayload[]|BufferResolvable[]} [files]
* The files to send with the message.
* @property {ActionRow[]|ActionRowBuilder[]} [components]
* Action rows containing interactive components for the message (buttons, select menus)
Expand Down
18 changes: 14 additions & 4 deletions packages/discord.js/src/util/APITypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10#APIChannel}
*/

/**
* @external APIChannelSelectComponent
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10#APIChannelSelectComponent}
*/

/**
* @external APIEmbed
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIEmbed}
Expand Down Expand Up @@ -98,6 +103,11 @@
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIInteractionGuildMember}
*/

/**
* @external APIMentionableSelectComponent
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10#APIMentionableSelectComponent}
*/

/**
* @external APIMessage
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIMessage}
Expand Down Expand Up @@ -139,13 +149,13 @@
*/

/**
* @external APISelectMenuComponent
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10#APISelectMenuComponent}
* @external APISelectMenuOption
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APISelectMenuOption}
*/

/**
* @external APISelectMenuOption
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APISelectMenuOption}
* @external APIStringSelectComponent
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIStringSelectComponent}
*/

/**
Expand Down
5 changes: 0 additions & 5 deletions packages/discord.js/src/util/Components.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,3 @@ const TextInputBuilder = require('../structures/TextInputBuilder');
const TextInputComponent = require('../structures/TextInputComponent');
const UserSelectMenuBuilder = require('../structures/UserSelectMenuBuilder');
const UserSelectMenuComponent = require('../structures/UserSelectMenuComponent');

/**
* @external JSONEncodable
* @see {@link https://discord.js.org/docs/packages/util/main/JSONEncodable:Interface}
*/

0 comments on commit 3e61725

Please sign in to comment.