Skip to content

Commit b1eca6a

Browse files
Improve documentation for ContainerBuilder class
Updated documentation comments for the ContainerBuilder class, including examples and clarifications.
1 parent 02fc101 commit b1eca6a

1 file changed

Lines changed: 10 additions & 17 deletions

File tree

packages/builders/src/components/v2/Container.ts

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ export interface ContainerBuilderData extends Partial<Omit<APIContainerComponent
3737

3838
/**
3939
* A builder that creates API-compatible JSON data for containers.
40+
*
41+
* @example
42+
* // Correct example of adding components:
43+
* container
44+
* .addSeparatorComponents(separator)
45+
* .addSectionComponents(section);
4046
*/
4147
export class ContainerBuilder extends ComponentBuilder<APIContainerComponent> {
4248
/**
@@ -103,7 +109,7 @@ export class ContainerBuilder extends ComponentBuilder<APIContainerComponent> {
103109
*/
104110
public addActionRowComponents(
105111
...input: RestOrArray<
106-
| ActionRowBuilder
112+
ActionRowBuilder
107113
| APIActionRowComponent<APIComponentInMessageActionRow>
108114
| ((builder: ActionRowBuilder) => ActionRowBuilder)
109115
>
@@ -198,29 +204,16 @@ export class ContainerBuilder extends ComponentBuilder<APIContainerComponent> {
198204
* Removes, replaces, or inserts components for this container
199205
*
200206
* @remarks
201-
* This method behaves similarly
202-
* to {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/splice | Array.prototype.splice()}.
207+
* This behaves like Array.prototype.splice()
203208
*
204-
* It's useful for modifying and adjusting order of the already-existing components of a container.
205209
* @example
206-
* Remove the first component:
207-
* ```ts
208210
* container.spliceComponents(0, 1);
209-
* ```
211+
*
210212
* @example
211-
* Remove the first n components:
212-
* ```ts
213-
* const n = 4;
214213
* container.spliceComponents(0, n);
215-
* ```
214+
*
216215
* @example
217-
* Remove the last component:
218-
* ```ts
219216
* container.spliceComponents(-1, 1);
220-
* ```
221-
* @param index - The index to start at
222-
* @param deleteCount - The number of components to remove
223-
* @param components - The replacing component objects
224217
*/
225218
public spliceComponents(
226219
index: number,

0 commit comments

Comments
 (0)