Skip to content
Typegatewayv0.11.0

GateContext

What a gateway gate's check receives, tagged by ctx.kind. Narrow on kind before reading interaction or payload.

See also:InteractionGateContext, EventGateContext

// a gate that takes either context narrows on ctx.kind
const Either = defineGate('either', (ctx: GateContext) => {
    if (ctx.kind === 'interaction') void ctx.interaction;
    else void ctx.payload;
});