Skip to content
Playground(another site)

bynk.event.pattern_type_mismatch

Error A from Events(E { ... }) subscription pattern field's matched value is not compatible with that field's declared type.

A subscription pattern compares a field with a literal or a variant, so the value must be of the field's type: an Int literal for an Int field, a String for a String, a variant of the field's own sum type. A value of any other type could never match an emission. Write one of the field's type.

Example

event Paid = { id: String, amount: Int }
service onPaid from Events(Paid { amount: "10", .. }) { // ✗ `amount` is an `Int`
service onPaid from Events(Paid { amount: 10, .. }) { // ✓

In the Book

See also

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