Skip to content
Playground(another site)

bynk.event.emit_not_an_event

Error Events.emit[E] named a type E that is declared in this context, but is not itself an event — only an event type may be emitted.

Events.emit[E] takes an event type. A plain type declared in the same context is refused: nothing could subscribe to it, since a from Events(…) header names events, so the emission would silently go nowhere. Declare the type with event instead, or name the event you meant. A name that is not declared in this context at all is bynk.event.emit_outside_owner.

Example

type Receipt = { id: String }
event Paid = { id: String }
Events.emit[Receipt](Receipt { id: id }) // ✗ `Receipt` is a `type`, not an `event`
Events.emit[Paid](Paid { id: id }) // ✓ an `event` of this context

In the Book

See also

  • Every code in its category, Events, on the diagnostic index.
  • bynk explain bynk.event.emit_not_an_event shows the same from the installed toolchain, without a network.