Skip to content

Commit 992b596

Browse files
committed
refactor: unions
1 parent 31dce6b commit 992b596

File tree

4 files changed

+128
-56
lines changed

4 files changed

+128
-56
lines changed

deno/payloads/v10/channel.ts

Lines changed: 32 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deno/payloads/v9/channel.ts

Lines changed: 32 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

payloads/v10/channel.ts

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1922,21 +1922,27 @@ export interface APIBaseAutoPopulatedSelectMenuComponent<
19221922
*
19231923
* String Selects can be configured for both single-select and multi-select behavior. When a user finishes making their choice(s) your app receives an interaction.
19241924
*
1925-
* String Selects must be placed inside an Action Row and are only available in messages. An Action Row can contain only one select menu and cannot contain buttons if it has a select menu.
1925+
* An Action Row can contain only one select menu and cannot contain buttons if it has a select menu.
19261926
*
19271927
* @see {@link https://discord.com/developers/docs/components/reference#string-select}
19281928
*/
1929-
export interface APIStringSelectComponent extends APIBaseSelectMenuComponent<ComponentType.StringSelect> {
1929+
export type APIStringSelectComponent = APIStringSelectComponentInActionRow | APIStringSelectComponentInModal;
1930+
1931+
export interface APIStringSelectComponentInActionRow extends APIBaseSelectMenuComponent<ComponentType.StringSelect> {
19301932
/**
19311933
* Specified choices in a select menu; max 25
19321934
*/
19331935
options: APISelectMenuOption[];
19341936
}
19351937

1936-
/**
1937-
* A string select menu component that may be used in modals.
1938-
*/
1939-
export interface APIStringSelectComponentInModal extends APIStringSelectComponent {
1938+
export interface APIStringSelectComponentInModal extends APIBaseSelectMenuComponent<ComponentType.StringSelect> {
1939+
/**
1940+
* Specified choices in a select menu; max 25
1941+
*/
1942+
options: APISelectMenuOption[];
1943+
/**
1944+
* Whether this component is required
1945+
*/
19401946
required?: boolean;
19411947
}
19421948

@@ -2035,6 +2041,16 @@ export type APISelectMenuComponent =
20352041
| APIStringSelectComponent
20362042
| APIUserSelectComponent;
20372043

2044+
/**
2045+
* @see {@link https://discord.com/developers/docs/components/reference}
2046+
*/
2047+
export type APISelectMenuComponentInMessage =
2048+
| APIChannelSelectComponent
2049+
| APIMentionableSelectComponent
2050+
| APIRoleSelectComponent
2051+
| APIStringSelectComponentInActionRow
2052+
| APIUserSelectComponent;
2053+
20382054
/**
20392055
* @see {@link https://discord.com/developers/docs/components/reference#string-select-select-option-structure}
20402056
*/
@@ -2099,22 +2115,24 @@ export interface APIBaseTextInputComponent extends APIBaseComponent<ComponentTyp
20992115
/**
21002116
* Text Input is an interactive component that allows users to enter free-form text responses in modals. It supports both short, single-line inputs and longer, multi-line paragraph inputs.
21012117
*
2102-
* Text Inputs can only be used within modals and must be placed inside a Label.
2118+
* Text Inputs can only be used within modals.
21032119
*
21042120
* When defining a text input component, you can set attributes to customize the behavior and appearance of it. However, not all attributes will be returned in the text input interaction payload.
21052121
*
21062122
* @see {@link https://discord.com/developers/docs/components/reference#text-input}
21072123
*/
2108-
export interface APITextInputComponent extends APIBaseTextInputComponent {
2124+
export type APITextInputComponent = APITextInputComponentInActionRow | APITextInputComponentInModal;
2125+
2126+
/**
2127+
* @deprecated
2128+
*/
2129+
export interface APITextInputComponentInActionRow extends APIBaseTextInputComponent {
21092130
/**
21102131
* Text that appears on top of the text input field, max 45 characters
21112132
*/
21122133
label: string;
21132134
}
21142135

2115-
/**
2116-
* A text input component that may be used in modals.
2117-
*/
21182136
export interface APITextInputComponentInModal extends APIBaseTextInputComponent {}
21192137

21202138
export enum UnfurledMediaItemLoadingState {
@@ -2411,7 +2429,7 @@ export type APIMessageComponent =
24112429
| APIFileComponent
24122430
| APIMediaGalleryComponent
24132431
| APISectionComponent
2414-
| APISelectMenuComponent
2432+
| APISelectMenuComponentInMessage
24152433
| APISeparatorComponent
24162434
| APITextDisplayComponent
24172435
| APIThumbnailComponent;
@@ -2441,12 +2459,12 @@ export type APIComponentInActionRow = APIComponentInMessageActionRow | APICompon
24412459
/**
24422460
* @see {@link https://discord.com/developers/docs/components/reference#action-row}
24432461
*/
2444-
export type APIComponentInMessageActionRow = APIButtonComponent | APISelectMenuComponent;
2462+
export type APIComponentInMessageActionRow = APIButtonComponent | APISelectMenuComponentInMessage;
24452463

24462464
/**
24472465
* @see {@link https://discord.com/developers/docs/components/reference#action-row}
24482466
*/
2449-
export type APIComponentInModalActionRow = APITextInputComponent;
2467+
export type APIComponentInModalActionRow = APITextInputComponentInActionRow;
24502468

24512469
/**
24522470
* @see {@link https://discord.com/developers/docs/components/reference#section}

0 commit comments

Comments
 (0)