mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 03:53:29 +01:00
types: remove createComponent and createComponentBuilder (#10687)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// This file contains the typedefs for camel-cased JSON data
|
|
||||||
const { ComponentBuilder } = require('@discordjs/builders');
|
const { ComponentBuilder } = require('@discordjs/builders');
|
||||||
const { ComponentType } = require('discord-api-types/v10');
|
const { ComponentType } = require('discord-api-types/v10');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} BaseComponentData
|
* @typedef {Object} BaseComponentData
|
||||||
* @property {ComponentType} type The type of component
|
* @property {ComponentType} type The type of component
|
||||||
@@ -71,6 +71,7 @@ const { ComponentType } = require('discord-api-types/v10');
|
|||||||
* Transforms API data into a component
|
* Transforms API data into a component
|
||||||
* @param {APIMessageComponent|Component} data The data to create the component from
|
* @param {APIMessageComponent|Component} data The data to create the component from
|
||||||
* @returns {Component}
|
* @returns {Component}
|
||||||
|
* @ignore
|
||||||
*/
|
*/
|
||||||
function createComponent(data) {
|
function createComponent(data) {
|
||||||
if (data instanceof Component) {
|
if (data instanceof Component) {
|
||||||
@@ -103,6 +104,7 @@ function createComponent(data) {
|
|||||||
* Transforms API data into a component builder
|
* Transforms API data into a component builder
|
||||||
* @param {APIMessageComponent|ComponentBuilder} data The data to create the component from
|
* @param {APIMessageComponent|ComponentBuilder} data The data to create the component from
|
||||||
* @returns {ComponentBuilder}
|
* @returns {ComponentBuilder}
|
||||||
|
* @ignore
|
||||||
*/
|
*/
|
||||||
function createComponentBuilder(data) {
|
function createComponentBuilder(data) {
|
||||||
if (data instanceof ComponentBuilder) {
|
if (data instanceof ComponentBuilder) {
|
||||||
|
|||||||
33
packages/discord.js/typings/index.d.ts
vendored
33
packages/discord.js/typings/index.d.ts
vendored
@@ -3562,28 +3562,6 @@ export function transformResolved<Cached extends CacheType>(
|
|||||||
): CommandInteractionResolvedData<Cached>;
|
): CommandInteractionResolvedData<Cached>;
|
||||||
export function resolveSKUId(resolvable: SKUResolvable): Snowflake | null;
|
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 */
|
/** @internal */
|
||||||
export interface CreateChannelOptions {
|
export interface CreateChannelOptions {
|
||||||
allowFromUnknownGuild?: boolean;
|
allowFromUnknownGuild?: boolean;
|
||||||
@@ -3597,17 +3575,6 @@ export function createChannel(
|
|||||||
extras?: CreateChannelOptions,
|
extras?: CreateChannelOptions,
|
||||||
): Channel;
|
): 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 */
|
/** @internal */
|
||||||
export function resolveBase64(data: Base64Resolvable): string;
|
export function resolveBase64(data: Base64Resolvable): string;
|
||||||
/** @internal */
|
/** @internal */
|
||||||
|
|||||||
Reference in New Issue
Block a user