Preview environment

class Component

export class Component<RawComponentData extends AnyComponent = AnyComponent>

Represents a component

Type Parameters

optional
RawComponentData? extends AnyComponent = AnyComponent

readonly
data : Readonly<RawComponentData>

The API data associated with this component

readonly
type : RawComponentData['type']

The type of the component

equals(
other: this | RawComponentData
) : boolean

Whether or not the given components are equal

toJSON() : RawComponentData

Returns the API-compatible JSON for this component