Skip to content

Commit

Permalink
fix: no | undefined for any array getter
Browse files Browse the repository at this point in the history
  • Loading branch information
didinele committed Sep 8, 2024
1 parent 30c5ac1 commit 6d44a77
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/builders/src/components/ActionRow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { TextInputBuilder } from './textInput/TextInput.js';

export interface ActionRowBuilderData
extends Partial<Omit<APIActionRowComponent<APIActionRowComponentTypes>, 'components'>> {
components?: AnyActionRowComponentBuilder[];
components: AnyActionRowComponentBuilder[];
}

/**
Expand All @@ -31,7 +31,7 @@ export class ActionRowBuilder extends ComponentBuilder<APIActionRowComponent<API
/**
* The components within this action row.
*/
public get components(): readonly AnyActionRowComponentBuilder[] | undefined {
public get components(): readonly AnyActionRowComponentBuilder[] {
return this.data.components;
}

Expand Down Expand Up @@ -74,7 +74,7 @@ export class ActionRowBuilder extends ComponentBuilder<APIActionRowComponent<API
this.data = {
...structuredClone(data),
type: ComponentType.ActionRow,
components: components?.map((component) => createComponentBuilder(component)),
components: components?.map((component) => createComponentBuilder(component)) ?? [],
};
}

Expand Down
6 changes: 3 additions & 3 deletions packages/builders/src/messages/embed/Embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { EmbedFooterBuilder } from './EmbedFooter.js';
*/
export interface EmbedBuilderData extends Omit<APIEmbed, 'author' | 'fields' | 'footer'> {
author?: EmbedAuthorBuilder;
fields?: EmbedFieldBuilder[];
fields: EmbedFieldBuilder[];
footer?: EmbedFooterBuilder;
}

Expand All @@ -29,7 +29,7 @@ export class EmbedBuilder implements JSONEncodable<APIEmbed> {
/**
* Gets the fields of this embed.
*/
public get fields(): readonly EmbedFieldBuilder[] | undefined {
public get fields(): readonly EmbedFieldBuilder[] {
return this.data.fields;
}

Expand All @@ -42,7 +42,7 @@ export class EmbedBuilder implements JSONEncodable<APIEmbed> {
this.data = {
...structuredClone(data),
author: data.author ? new EmbedAuthorBuilder(data.author) : undefined,
fields: data.fields?.map((field) => new EmbedFieldBuilder(field)),
fields: data.fields?.map((field) => new EmbedFieldBuilder(field)) ?? [],
footer: data.footer ? new EmbedFooterBuilder(data.footer) : undefined,
};
}
Expand Down

0 comments on commit 6d44a77

Please sign in to comment.