Skip to content

Commit

Permalink
types: remove createComponent and createComponentBuilder (#10687)
Browse files Browse the repository at this point in the history
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
almeidx and kodiakhq[bot] authored Jan 13, 2025
1 parent ae0265e commit 6314d96
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 34 deletions.
4 changes: 3 additions & 1 deletion packages/discord.js/src/util/Components.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

// This file contains the typedefs for camel-cased JSON data
const { ComponentBuilder } = require('@discordjs/builders');
const { ComponentType } = require('discord-api-types/v10');

/**
* @typedef {Object} BaseComponentData
* @property {ComponentType} type The type of component
Expand Down Expand Up @@ -71,6 +71,7 @@ const { ComponentType } = require('discord-api-types/v10');
* Transforms API data into a component
* @param {APIMessageComponent|Component} data The data to create the component from
* @returns {Component}
* @ignore
*/
function createComponent(data) {
if (data instanceof Component) {
Expand Down Expand Up @@ -103,6 +104,7 @@ function createComponent(data) {
* Transforms API data into a component builder
* @param {APIMessageComponent|ComponentBuilder} data The data to create the component from
* @returns {ComponentBuilder}
* @ignore
*/
function createComponentBuilder(data) {
if (data instanceof ComponentBuilder) {
Expand Down
33 changes: 0 additions & 33 deletions packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3562,28 +3562,6 @@ export function transformResolved<Cached extends CacheType>(
): CommandInteractionResolvedData<Cached>;
export function resolveSKUId(resolvable: SKUResolvable): Snowflake | null;

export interface MappedComponentBuilderTypes {
[ComponentType.Button]: ButtonBuilder;
[ComponentType.StringSelect]: StringSelectMenuBuilder;
[ComponentType.UserSelect]: UserSelectMenuBuilder;
[ComponentType.RoleSelect]: RoleSelectMenuBuilder;
[ComponentType.MentionableSelect]: MentionableSelectMenuBuilder;
[ComponentType.ChannelSelect]: ChannelSelectMenuBuilder;
[ComponentType.ActionRow]: ActionRowBuilder;
[ComponentType.TextInput]: TextInputBuilder;
}

export interface MappedComponentTypes {
[ComponentType.Button]: ButtonComponent;
[ComponentType.StringSelect]: StringSelectMenuComponent;
[ComponentType.UserSelect]: UserSelectMenuComponent;
[ComponentType.RoleSelect]: RoleSelectMenuComponent;
[ComponentType.MentionableSelect]: MentionableSelectMenuComponent;
[ComponentType.ChannelSelect]: ChannelSelectMenuComponent;
[ComponentType.ActionRow]: ActionRowComponent;
[ComponentType.TextInput]: TextInputComponent;
}

/** @internal */
export interface CreateChannelOptions {
allowFromUnknownGuild?: boolean;
Expand All @@ -3597,17 +3575,6 @@ export function createChannel(
extras?: CreateChannelOptions,
): Channel;

export function createComponent<Type extends keyof MappedComponentTypes>(
data: APIMessageComponent & { type: Type },
): MappedComponentTypes[Type];
export function createComponent<Data extends Component>(data: Data): Data;
export function createComponent(data: APIMessageComponent | Component): Component;
export function createComponentBuilder<Type extends keyof MappedComponentBuilderTypes>(
data: APIMessageComponent & { type: Type },
): MappedComponentBuilderTypes[Type];
export function createComponentBuilder<Data extends ComponentBuilder>(data: Data): Data;
export function createComponentBuilder(data: APIMessageComponent | ComponentBuilder): ComponentBuilder;

/** @internal */
export function resolveBase64(data: Base64Resolvable): string;
/** @internal */
Expand Down

0 comments on commit 6314d96

Please sign in to comment.