refactor: make data public in builders (#7486)

This commit is contained in:
Suneet Tipirneni
2022-02-20 07:43:27 -05:00
committed by GitHub
parent 8dbd34544c
commit ba31203a0a
4 changed files with 8 additions and 2 deletions

View File

@@ -15,6 +15,9 @@ export type ActionRowComponent = ButtonComponent | SelectMenuComponent;
export class ActionRow<T extends ActionRowComponent = ActionRowComponent> extends Component<
Omit<Partial<APIActionRowComponent<APIMessageComponent>> & { type: ComponentType.ActionRow }, 'components'>
> {
/**
* The components within this action row
*/
public readonly components: T[];
public constructor({ components, ...data }: Partial<APIActionRowComponent<APIMessageComponent>> = {}) {

View File

@@ -19,7 +19,7 @@ export abstract class Component<
/**
* The API data associated with this component
*/
protected readonly data: DataType;
public readonly data: DataType;
public abstract toJSON(): APIMessageComponent;

View File

@@ -9,6 +9,9 @@ import isEqual from 'fast-deep-equal';
export class UnsafeSelectMenuComponent extends Component<
Partial<Omit<APISelectMenuComponent, 'options'>> & { type: ComponentType.SelectMenu }
> {
/**
* The options within this select menu
*/
public readonly options: UnsafeSelectMenuOption[];
public constructor(data?: Partial<APISelectMenuComponent>) {