Skip to content
This repository was archived by the owner on Jan 8, 2022. It is now read-only.

Commit 7723ad0

Browse files
fix: properly type toJSON methods (#34)
1 parent ac299cd commit 7723ad0

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/interactions/slashCommands/SlashCommandBuilder.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { APIApplicationCommandOption } from 'discord-api-types/v9';
1+
import type { APIApplicationCommandOption, RESTPostAPIApplicationCommandsJSONBody } from 'discord-api-types/v9';
22
import { mix } from 'ts-mixer';
33
import {
44
assertReturnOfBuilder,
@@ -38,7 +38,7 @@ export class SlashCommandBuilder {
3838
*
3939
* **Note:** Calling this function will validate required properties based on their conditions.
4040
*/
41-
public toJSON() {
41+
public toJSON(): RESTPostAPIApplicationCommandsJSONBody {
4242
validateRequiredParameters(this.name, this.description, this.options);
4343
return {
4444
name: this.name,

src/interactions/slashCommands/SlashCommandSubcommands.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ApplicationCommandOptionType } from 'discord-api-types/v9';
1+
import { APIApplicationCommandSubCommandOptions, ApplicationCommandOptionType } from 'discord-api-types/v9';
22
import { mix } from 'ts-mixer';
33
import { assertReturnOfBuilder, validateMaxOptionsLength, validateRequiredParameters } from './Assertions';
44
import { SharedSlashCommandOptions } from './mixins/CommandOptions';
@@ -52,7 +52,7 @@ export class SlashCommandSubcommandGroupBuilder implements ToAPIApplicationComma
5252
return this;
5353
}
5454

55-
public toJSON() {
55+
public toJSON(): APIApplicationCommandSubCommandOptions {
5656
validateRequiredParameters(this.name, this.description, this.options);
5757
return {
5858
type: ApplicationCommandOptionType.SubcommandGroup,
@@ -87,7 +87,7 @@ export class SlashCommandSubcommandBuilder implements ToAPIApplicationCommandOpt
8787
*/
8888
public readonly options: ToAPIApplicationCommandOptions[] = [];
8989

90-
public toJSON() {
90+
public toJSON(): APIApplicationCommandSubCommandOptions {
9191
validateRequiredParameters(this.name, this.description, this.options);
9292
return {
9393
type: ApplicationCommandOptionType.Subcommand,

0 commit comments

Comments
 (0)