Skip to content

EventConfig

EventConfig<TMetadata, TCategory> = CoreEventConfig<TMetadata, TCategory> | BaseEventProperties<TMetadata, TCategory> & object

Generic event config - extended by plugins. Use the generic parameter to enforce metadata types.

The open (plugin) arm carries the full BaseEventProperties — so every event config, core or plugin, is guaranteed an id and title. It has no [key: string]: unknown index signature, so a plugin’s own interface (LunarEvent, OffsetEvent, …) stays assignable without an as cast.

TMetadata extends Record<string, unknown> = Record<string, unknown>

Custom metadata type extending Record<string, unknown>

TCategory extends string = string

// Basic usage (any metadata)
const event: EventConfig = { type: "const", id: "x", ... };
// With typed metadata
interface MyMetadata { rank: string; color: string; }
const event: EventConfig<MyMetadata> = { ... metadata: { rank: "high", color: "red" } };