Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: convert comment into private remark #10097

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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