Skip to content

Commit e094faf

Browse files
almeidxQjuhkodiakhq[bot]
authored
docs: add missing, fix existing (#10842)
* docs: add missing, fix existing * refactor: new stuff * fix: requested changes * fix: use `@link` for `@mixes` Co-authored-by: Qjuh <[email protected]> * chore: disable bad eslint rule --------- Co-authored-by: Qjuh <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent 8d50e92 commit e094faf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+377
-139
lines changed

eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ export default tseslint.config(
135135
files: [`packages/builders/**/*${commonFiles}`],
136136
rules: {
137137
'@typescript-eslint/no-empty-object-type': 0,
138+
'jsdoc/valid-types': 0,
138139
},
139140
},
140141
{

packages/builders/src/components/ActionRow.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable jsdoc/check-param-names */
2-
31
import type {
42
APITextInputComponent,
53
APIActionRowComponent,
@@ -43,10 +41,11 @@ export interface ActionRowBuilderData
4341

4442
/**
4543
* A builder that creates API-compatible JSON data for action rows.
46-
*
47-
* @typeParam ComponentType - The types of components this action row holds
4844
*/
4945
export class ActionRowBuilder extends ComponentBuilder<APIActionRowComponent<APIComponentInActionRow>> {
46+
/**
47+
* @internal
48+
*/
5049
protected readonly data: ActionRowBuilderData;
5150

5251
/**
@@ -57,7 +56,7 @@ export class ActionRowBuilder extends ComponentBuilder<APIActionRowComponent<API
5756
}
5857

5958
/**
60-
* Creates a new action row from API data.
59+
* Creates a new action row.
6160
*
6261
* @param data - The API data to create this action row with
6362
* @example
@@ -90,12 +89,15 @@ export class ActionRowBuilder extends ComponentBuilder<APIActionRowComponent<API
9089
* .addComponents(button2, button3);
9190
* ```
9291
*/
93-
public constructor({ components = [], ...data }: Partial<APIActionRowComponent<APIComponentInActionRow>> = {}) {
92+
public constructor(data: Partial<APIActionRowComponent<APIComponentInActionRow>> = {}) {
9493
super();
94+
95+
const { components = [], ...rest } = data;
96+
9597
this.data = {
96-
...structuredClone(data),
97-
type: ComponentType.ActionRow,
98+
...structuredClone(rest),
9899
components: components.map((component) => createComponentBuilder(component)),
100+
type: ComponentType.ActionRow,
99101
};
100102
}
101103

packages/builders/src/components/Component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ export interface ComponentBuilderBaseData {
1313
export abstract class ComponentBuilder<Component extends APIBaseComponent<ComponentType>>
1414
implements JSONEncodable<Component>
1515
{
16+
/**
17+
* @internal
18+
*/
1619
protected abstract readonly data: ComponentBuilderBaseData;
1720

1821
/**

packages/builders/src/components/button/Button.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import { ComponentBuilder } from '../Component.js';
77
* A builder that creates API-compatible JSON data for buttons.
88
*/
99
export abstract class BaseButtonBuilder<ButtonData extends APIButtonComponent> extends ComponentBuilder<ButtonData> {
10+
/**
11+
* @internal
12+
*/
1013
declare protected readonly data: Partial<ButtonData>;
1114

1215
/**

packages/builders/src/components/button/CustomIdButton.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ export type CustomIdButtonStyle = APIButtonComponentWithCustomId['style'];
77

88
/**
99
* A builder that creates API-compatible JSON data for buttons with custom IDs.
10+
*
11+
* @mixes {@link BaseButtonBuilder}\<{@link discord-api-types/v10#(APIButtonComponentWithCustomId:interface)}\>
12+
* @mixes {@link EmojiOrLabelButtonMixin}
1013
*/
1114
export abstract class CustomIdButtonBuilder extends Mixin(
1215
BaseButtonBuilder<APIButtonComponentWithCustomId>,

packages/builders/src/components/button/LinkButton.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import { EmojiOrLabelButtonMixin } from './mixins/EmojiOrLabelButtonMixin.js';
1010

1111
/**
1212
* A builder that creates API-compatible JSON data for buttons with links.
13+
*
14+
* @mixes {@link BaseButtonBuilder}\<{@link discord-api-types/v10#(APIButtonComponentWithURL:interface)}\>
15+
* @mixes {@link EmojiOrLabelButtonMixin}
1316
*/
1417
export class LinkButtonBuilder extends Mixin(BaseButtonBuilder<APIButtonComponentWithURL>, EmojiOrLabelButtonMixin) {
1518
protected override readonly data: Partial<APIButtonComponentWithURL>;

packages/builders/src/components/button/mixins/EmojiOrLabelButtonMixin.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ import type { APIButtonComponent, APIButtonComponentWithSKUId, APIMessageCompone
33
export interface EmojiOrLabelButtonData
44
extends Pick<Exclude<APIButtonComponent, APIButtonComponentWithSKUId>, 'emoji' | 'label'> {}
55

6+
/**
7+
* A mixin that adds emoji and label symbols to a button builder.
8+
*/
69
export class EmojiOrLabelButtonMixin {
10+
/**
11+
* @internal
12+
*/
713
declare protected readonly data: EmojiOrLabelButtonData;
814

915
/**

packages/builders/src/components/selectMenu/BaseSelectMenu.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@ import { ComponentBuilder } from '../Component.js';
55
/**
66
* The base select menu builder that contains common symbols for select menu builders.
77
*
8-
* @typeParam SelectMenuType - The type of select menu this would be instantiated for.
8+
* @typeParam Data - The type of API data that is stored within the builder
99
*/
1010
export abstract class BaseSelectMenuBuilder<Data extends APISelectMenuComponent>
1111
extends ComponentBuilder<Data>
1212
implements JSONEncodable<APISelectMenuComponent>
1313
{
14+
/**
15+
* @internal
16+
*/
1417
protected abstract override readonly data: Partial<
1518
Pick<Data, 'custom_id' | 'disabled' | 'id' | 'max_values' | 'min_values' | 'placeholder'>
1619
>;

packages/builders/src/components/selectMenu/ChannelSelectMenu.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ export class ChannelSelectMenuBuilder extends BaseSelectMenuBuilder<APIChannelSe
1717
protected override readonly data: Partial<APIChannelSelectComponent>;
1818

1919
/**
20-
* Creates a new select menu from API data.
20+
* Creates a new channel select menu.
2121
*
22-
* @param data - The API data to create this select menu with
22+
* @param data - The API data to create this channel select menu with
2323
* @example
2424
* Creating a select menu from an API data object:
2525
* ```ts

packages/builders/src/components/selectMenu/MentionableSelectMenu.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ export class MentionableSelectMenuBuilder extends BaseSelectMenuBuilder<APIMenti
1717
protected override readonly data: Partial<APIMentionableSelectComponent>;
1818

1919
/**
20-
* Creates a new select menu from API data.
20+
* Creates a new mentionable select menu.
2121
*
22-
* @param data - The API data to create this select menu with
22+
* @param data - The API data to create this mentionable select menu with
2323
* @example
2424
* Creating a select menu from an API data object:
2525
* ```ts

0 commit comments

Comments
 (0)