import type { JSONEncodable } from '../util/jsonEncodable'; import type { APIActionRowComponent, APIActionRowComponentTypes, APIBaseComponent, APIMessageActionRowComponent, APIModalActionRowComponent, APIMessageComponent, ComponentType, APIModalComponent, } from 'discord-api-types/v9'; import type { Equatable } from '../util/equatable'; /** * Represents a discord component */ export abstract class Component< DataType extends Partial> & { type: ComponentType; } = APIBaseComponent, > implements JSONEncodable< | APIModalComponent | APIMessageComponent | APIActionRowComponent >, Equatable< | Component | APIActionRowComponentTypes | APIActionRowComponent > { /** * The API data associated with this component */ public readonly data: DataType; public abstract toJSON(): | APIActionRowComponentTypes | APIActionRowComponent; public abstract equals( other: | Component | APIActionRowComponentTypes | APIActionRowComponent, ): boolean; public constructor(data: DataType) { this.data = data; } /** * The type of this component */ public get type(): DataType['type'] { return this.data.type; } }