types: remove createComponent and createComponentBuilder (#10687)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Almeida
2025-01-13 10:08:26 +00:00
committed by Jiralite
parent 32dff01f29
commit 0047a49b73
2 changed files with 3 additions and 34 deletions

View File

@@ -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
@@ -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) {
@@ -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) {

View File

@@ -3684,28 +3684,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;
@@ -3719,17 +3697,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;
/** @deprecated This class is redundant as all methods of the class can be imported from discord.js directly. */
export class Formatters extends null {
/** @deprecated Import this method directly from discord.js instead. */