From 4be95ae269efc976add463a0169615743a2f0aad Mon Sep 17 00:00:00 2001 From: suneettipirneni Date: Sat, 12 Feb 2022 22:31:50 -0500 Subject: [PATCH] fix: remove cast --- packages/builders/src/components/ActionRow.ts | 5 ++--- packages/builders/src/components/Component.ts | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/builders/src/components/ActionRow.ts b/packages/builders/src/components/ActionRow.ts index d68031f2faad..2789bae26144 100644 --- a/packages/builders/src/components/ActionRow.ts +++ b/packages/builders/src/components/ActionRow.ts @@ -12,7 +12,7 @@ export type ActionRowComponent = ButtonComponent | SelectMenuComponent; * Represents an action row component */ export class ActionRow extends Component< - Omit, 'components'> + Omit & { type: ComponentType.ActionRow }, 'components'> > { public readonly components: T[]; @@ -41,10 +41,9 @@ export class ActionRow extend } public toJSON(): APIActionRowComponent { - // eslint-disable-next-line @typescript-eslint/consistent-type-assertions return { ...this.data, components: this.components.map((component) => component.toJSON()), - } as APIActionRowComponent; + }; } } diff --git a/packages/builders/src/components/Component.ts b/packages/builders/src/components/Component.ts index beca493467b8..ed5da17fc0f2 100644 --- a/packages/builders/src/components/Component.ts +++ b/packages/builders/src/components/Component.ts @@ -5,7 +5,9 @@ import type { APIBaseMessageComponent, APIMessageComponent, ComponentType } from * Represents a discord component */ export abstract class Component< - DataType extends Partial> = APIBaseMessageComponent, + DataType extends Partial> & { + type: ComponentType; + } = APIBaseMessageComponent, > implements JSONEncodable { /**