Skip to content

Commit

Permalink
docs: convert comment into private remark (#10097)
Browse files Browse the repository at this point in the history
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
almeidx and kodiakhq[bot] authored Jan 22, 2024
1 parent a0c83a2 commit bfc7bb5
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1208,31 +1208,37 @@ export class CommandInteractionOptionResolver<Cached extends CacheType = CacheTy
public getSubcommandGroup(required?: boolean): string | null;
public getBoolean(name: string, required: true): boolean;
public getBoolean(name: string, required?: boolean): boolean | null;
/**
* @privateRemarks
* The ternary in the return type is required.
* The `type` property of the {@link PublicThreadChannel} interface is typed as `ChannelType.PublicThread | ChannelType.AnnouncementThread`.
* If the user were to pass only one of those channel types, the `Extract<>` would resolve to `never`.
*/
public getChannel<const Type extends ChannelType = ChannelType>(
name: string,
required: true,
channelTypes?: readonly Type[],
): Extract<
NonNullable<CommandInteractionOption<Cached>['channel']>,
{
// The `type` property of the PublicThreadChannel class is typed as `ChannelType.PublicThread | ChannelType.AnnouncementThread`
// If the user only passed one of those channel types, the Extract<> would have resolved to `never`
// Hence the need for this ternary
type: Type extends ChannelType.PublicThread | ChannelType.AnnouncementThread
? ChannelType.PublicThread | ChannelType.AnnouncementThread
: Type;
}
>;
/**
* @privateRemarks
* The ternary in the return type is required.
* The `type` property of the {@link PublicThreadChannel} interface is typed as `ChannelType.PublicThread | ChannelType.AnnouncementThread`.
* If the user were to pass only one of those channel types, the `Extract<>` would resolve to `never`.
*/
public getChannel<const Type extends ChannelType = ChannelType>(
name: string,
required?: boolean,
channelTypes?: readonly Type[],
): Extract<
NonNullable<CommandInteractionOption<Cached>['channel']>,
{
// The `type` property of the PublicThreadChannel class is typed as `ChannelType.PublicThread | ChannelType.AnnouncementThread`
// If the user only passed one of those channel types, the Extract<> would have resolved to `never`
// Hence the need for this ternary
type: Type extends ChannelType.PublicThread | ChannelType.AnnouncementThread
? ChannelType.PublicThread | ChannelType.AnnouncementThread
: Type;
Expand Down

0 comments on commit bfc7bb5

Please sign in to comment.