Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActionRowBuilder parameter type is private #9256

Closed
offeex opened this issue Mar 20, 2023 · 3 comments
Closed

ActionRowBuilder parameter type is private #9256

offeex opened this issue Mar 20, 2023 · 3 comments

Comments

@offeex
Copy link

offeex commented Mar 20, 2023

Which package is this feature request for?

builders

Feature

Problem with ActionRowBuilder, it requires you to specify generic type explicitly.
I tried to have workaround for it, looks like this:

export function actionRow<T>(...builder: T[]) {
	return new ActionRowBuilder<T>().setComponents(builder as any)
}

Key point is that i can't use it's parameter type to generify my function:

type MessageComponentBuilder = ActionRowBuilder<MessageActionRowComponentBuilder> | MessageActionRowComponentBuilder;
type ModalComponentBuilder = ActionRowBuilder<ModalActionRowComponentBuilder> | ModalActionRowComponentBuilder;
type MessageActionRowComponentBuilder = ButtonBuilder | ChannelSelectMenuBuilder | MentionableSelectMenuBuilder | RoleSelectMenuBuilder | StringSelectMenuBuilder | UserSelectMenuBuilder;
type ModalActionRowComponentBuilder = TextInputBuilder;
type AnyComponentBuilder = MessageActionRowComponentBuilder | ModalActionRowComponentBuilder;

Ideal solution or implementation

Simple fix, just add the export qualifier to the types declaration

export type MessageComponentBuilder = ActionRowBuilder<MessageActionRowComponentBuilder> | MessageActionRowComponentBuilder;
export type ModalComponentBuilder = ActionRowBuilder<ModalActionRowComponentBuilder> | ModalActionRowComponentBuilder;
export type MessageActionRowComponentBuilder = ButtonBuilder | ChannelSelectMenuBuilder | MentionableSelectMenuBuilder | RoleSelectMenuBuilder | StringSelectMenuBuilder | UserSelectMenuBuilder;
export type ModalActionRowComponentBuilder = TextInputBuilder;
export type AnyComponentBuilder = MessageActionRowComponentBuilder | ModalActionRowComponentBuilder;

Alternative solutions or implementations

No response

Other context

No response

@jaw0r3k
Copy link
Contributor

jaw0r3k commented Mar 21, 2023

isnt it already exported?

export type MessageComponentBuilder =
| ActionRowBuilder<MessageActionRowComponentBuilder>
| MessageActionRowComponentBuilder;
export type ModalComponentBuilder = ActionRowBuilder<ModalActionRowComponentBuilder> | ModalActionRowComponentBuilder;
export type MessageActionRowComponentBuilder =
| ButtonBuilder
| ChannelSelectMenuBuilder
| MentionableSelectMenuBuilder
| RoleSelectMenuBuilder
| StringSelectMenuBuilder
| UserSelectMenuBuilder;
export type ModalActionRowComponentBuilder = TextInputBuilder;
export type AnyComponentBuilder = MessageActionRowComponentBuilder | ModalActionRowComponentBuilder;

@offeex
Copy link
Author

offeex commented Mar 22, 2023

isnt it already exported?

export type MessageComponentBuilder =
| ActionRowBuilder<MessageActionRowComponentBuilder>
| MessageActionRowComponentBuilder;
export type ModalComponentBuilder = ActionRowBuilder<ModalActionRowComponentBuilder> | ModalActionRowComponentBuilder;
export type MessageActionRowComponentBuilder =
| ButtonBuilder
| ChannelSelectMenuBuilder
| MentionableSelectMenuBuilder
| RoleSelectMenuBuilder
| StringSelectMenuBuilder
| UserSelectMenuBuilder;
export type ModalActionRowComponentBuilder = TextInputBuilder;
export type AnyComponentBuilder = MessageActionRowComponentBuilder | ModalActionRowComponentBuilder;

it's not, at least for me. i'm using version 14.8.0 (latest atm)
image

@offeex
Copy link
Author

offeex commented Mar 22, 2023

Well, did some research, and found this in the end of the file, and it seems to work, once i import it manually:
image

@offeex offeex closed this as completed Mar 22, 2023
@Jiralite Jiralite closed this as not planned Won't fix, can't repro, duplicate, stale Mar 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants