Skip to content

Commit 277fe68

Browse files
committed
fix(modalSubmit): proper types
1 parent 42bfca7 commit 277fe68

File tree

4 files changed

+56
-20
lines changed

4 files changed

+56
-20
lines changed

deno/payloads/v10/_interactions/modalSubmit.ts

Lines changed: 14 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: 14 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: 14 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,27 @@ 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 APIModalSubmitStringSelectComponent extends APIBaseModalSubmitComponent<ComponentType.StringSelect> {
20+
values: string[];
21+
}
22+
23+
export type ModalSubmitComponent = APIModalSubmitStringSelectComponent | APIModalSubmitTextInputComponent;
24+
1625
export interface ModalSubmitActionRowComponent extends APIBaseComponent<ComponentType.ActionRow> {
17-
components: ModalSubmitComponent[];
26+
components: APIModalSubmitTextInputComponent[];
1827
}
1928

2029
export interface ModalSubmitLabelComponent extends APIBaseComponent<ComponentType.Label> {
21-
component: APIComponentInModalLabel;
30+
component: ModalSubmitComponent;
2231
}
2332

2433
/**

payloads/v9/_interactions/modalSubmit.ts

Lines changed: 14 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,27 @@ 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 APIModalSubmitStringSelectComponent extends APIBaseModalSubmitComponent<ComponentType.StringSelect> {
20+
values: string[];
21+
}
22+
23+
export type ModalSubmitComponent = APIModalSubmitStringSelectComponent | APIModalSubmitTextInputComponent;
24+
1625
export interface ModalSubmitActionRowComponent extends APIBaseComponent<ComponentType.ActionRow> {
17-
components: ModalSubmitComponent[];
26+
components: APIModalSubmitTextInputComponent[];
1827
}
1928

2029
export interface ModalSubmitLabelComponent extends APIBaseComponent<ComponentType.Label> {
21-
component: APIComponentInModalLabel;
30+
component: ModalSubmitComponent;
2231
}
2332

2433
/**

0 commit comments

Comments
 (0)