Skip to content

Commit 369800e

Browse files
committed
fix(modalSubmit): proper types
1 parent 42bfca7 commit 369800e

File tree

4 files changed

+92
-20
lines changed

4 files changed

+92
-20
lines changed

deno/payloads/v10/_interactions/modalSubmit.ts

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

deno/payloads/v9/_interactions/modalSubmit.ts

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

payloads/v10/_interactions/modalSubmit.ts

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { APIBaseComponent, APIComponentInModalLabel } from '../channel';
1+
import type { APIBaseComponent } from '../channel';
22
import type {
33
APIBaseInteraction,
44
APIDMInteractionWrapper,
@@ -7,18 +7,36 @@ import type {
77
InteractionType,
88
} from '../index';
99

10-
export interface ModalSubmitComponent {
11-
type: ComponentType;
10+
export interface APIBaseModalSubmitComponent<T extends ComponentType> extends APIBaseComponent<T> {
11+
type: T;
1212
custom_id: string;
13+
}
14+
15+
export interface APIModalSubmitTextInputComponent extends APIBaseModalSubmitComponent<ComponentType.TextInput> {
1316
value: string;
1417
}
1518

19+
export interface APIModalSubmitStringSelectComponentInLabelComponent
20+
extends APIBaseModalSubmitComponent<ComponentType.StringSelect> {
21+
values: string[];
22+
}
23+
24+
export type ModalSubmitComponent =
25+
| APIModalSubmitStringSelectComponentInLabelComponent
26+
| APIModalSubmitTextInputComponent;
27+
1628
export interface ModalSubmitActionRowComponent extends APIBaseComponent<ComponentType.ActionRow> {
17-
components: ModalSubmitComponent[];
29+
components: APIModalSubmitTextInputComponent[];
1830
}
1931

2032
export interface ModalSubmitLabelComponent extends APIBaseComponent<ComponentType.Label> {
21-
component: APIComponentInModalLabel;
33+
component: ModalSubmitComponent;
34+
}
35+
36+
export interface APIModalSubmitStringSelectComponentInLabelComponent {
37+
type: ComponentType.StringSelect;
38+
values: string[];
39+
custom_id: string;
2240
}
2341

2442
/**

payloads/v9/_interactions/modalSubmit.ts

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { APIBaseComponent, APIComponentInModalLabel } from '../channel';
1+
import type { APIBaseComponent } from '../channel';
22
import type {
33
APIBaseInteraction,
44
APIDMInteractionWrapper,
@@ -7,18 +7,36 @@ import type {
77
InteractionType,
88
} from '../index';
99

10-
export interface ModalSubmitComponent {
11-
type: ComponentType;
10+
export interface APIBaseModalSubmitComponent<T extends ComponentType> extends APIBaseComponent<T> {
11+
type: T;
1212
custom_id: string;
13+
}
14+
15+
export interface APIModalSubmitTextInputComponent extends APIBaseModalSubmitComponent<ComponentType.TextInput> {
1316
value: string;
1417
}
1518

19+
export interface APIModalSubmitStringSelectComponentInLabelComponent
20+
extends APIBaseModalSubmitComponent<ComponentType.StringSelect> {
21+
values: string[];
22+
}
23+
24+
export type ModalSubmitComponent =
25+
| APIModalSubmitStringSelectComponentInLabelComponent
26+
| APIModalSubmitTextInputComponent;
27+
1628
export interface ModalSubmitActionRowComponent extends APIBaseComponent<ComponentType.ActionRow> {
17-
components: ModalSubmitComponent[];
29+
components: APIModalSubmitTextInputComponent[];
1830
}
1931

2032
export interface ModalSubmitLabelComponent extends APIBaseComponent<ComponentType.Label> {
21-
component: APIComponentInModalLabel;
33+
component: ModalSubmitComponent;
34+
}
35+
36+
export interface APIModalSubmitStringSelectComponentInLabelComponent {
37+
type: ComponentType.StringSelect;
38+
values: string[];
39+
custom_id: string;
2240
}
2341

2442
/**

0 commit comments

Comments
 (0)