[Resolved] Before hook type error

reference: Heroic Labs Documentation | Matchmaker

in the example code from the docs:

function InitModule(ctx: nkruntime.Context, logger: nkruntime.Logger, nk: nkruntime.Nakama, initializer: nkruntime.Initializer) {
  initializer.registerRtBefore("MatchmakerAdd", beforeMatchmakerAdd)
}

const beforeMatchmakerAdd : nkruntime.RtBeforeHookFunction<nkruntime.EnvelopeMatchmakerAdd> = function (ctx: nkruntime.Context, logger: nkruntime.Logger, nk: nkruntime.Nakama, envelope: nkruntime.EnvelopeMatchmakerAdd) : nkruntime.EnvelopeMatchmakerAdd | void {
  const region = envelope.matchmakerAdd.stringProperties["region"];

  // If the string properties contain a region value of "europe", modify it to "europe-west"
  if (region && region == "europe") {
    envelope.matchmakerAdd.stringProperties["region"] = "europe-west";
  }

  return envelope;
}

initializing beforeMatchmakerAdd gives me a type error:

Argument of type 'RtBeforeHookFunction<EnvelopeMatchmakerAdd>' is not  assignable  to parameter of type 'RtBeforeHookFunction<Envelope>'. Type 'Envelope' is not assignable to type 'EnvelopeMatchmakerAdd'

am I missing something?

fixed this by making the type to be just Envelope and just added this inside the function const e = envelope as nkruntime.EnvelopeMatchmakerAdd that way I can now access matchmakerAdd