Skip to content

Commit

Permalink
types: unify ApplicationCommandManager#create overloads (#6970)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladfrangu committed Nov 11, 2021
1 parent c30a818 commit 8e881d2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2643,8 +2643,7 @@ export class ApplicationCommandManager<
null
>;
private commandPath({ id, guildId }: { id?: Snowflake; guildId?: Snowflake }): unknown;
public create(command: ApplicationCommandDataResolvable): Promise<ApplicationCommandScope>;
public create(command: ApplicationCommandDataResolvable, guildId: Snowflake): Promise<ApplicationCommand>;
public create(command: ApplicationCommandDataResolvable, guildId?: Snowflake): Promise<ApplicationCommandScope>;
public delete(command: ApplicationCommandResolvable, guildId?: Snowflake): Promise<ApplicationCommandScope | null>;
public edit(
command: ApplicationCommandResolvable,
Expand Down
3 changes: 2 additions & 1 deletion typings/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,8 @@ declare const applicationCommandManager: ApplicationCommandManager;
type ApplicationCommandScope = ApplicationCommand<{ guild: GuildResolvable }>;

assertType<Promise<ApplicationCommandScope>>(applicationCommandManager.create(applicationCommandData));
assertType<Promise<ApplicationCommand>>(applicationCommandManager.create(applicationCommandData, '0'));
assertType<Promise<ApplicationCommandScope>>(applicationCommandManager.create(applicationCommandData, '0'));
assertType<Promise<ApplicationCommandScope>>(applicationCommandManager.create(applicationCommandData, undefined));
assertType<Promise<ApplicationCommandScope>>(
applicationCommandManager.edit(applicationCommandResolvable, applicationCommandData),
);
Expand Down

0 comments on commit 8e881d2

Please sign in to comment.