# Accessing match properties in RPC functions

**URL:** <https://forum.heroiclabs.com/t/accessing-match-properties-in-rpc-functions/2657>\
**Category:** Game Design\
**Tags:** server-framework, typescript\
**Created:** [May 23, 2022, 12:51pm UTC](https://forum.heroiclabs.com/t/accessing-match-properties-in-rpc-functions/2657 "2022-05-23T12:51:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![solidsnakeit](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@solidsnakeit](https://forum.heroiclabs.com/u/solidsnakeit)\
**Post date:** [May 23, 2022, 12:51pm UTC](https://forum.heroiclabs.com/t/accessing-match-properties-in-rpc-functions/2657/1 "2022-05-23T12:51:44Z")

</div>

Hello,

I refer to this ticket: [Make a match with 1 player only](https://forum.heroiclabs.com/t/make-a-match-with-1-player-only/2630)

I open this new case as it is a separate issue from the original ticket.

I need to read the properties of the match object in an RPC function.

The complete code is follows:

```auto
function rpcLSfindOrCreateMatch(context: nkruntime.Context, logger: nkruntime.Logger, nk: nkruntime.Nakama, payload: string): string
{
    let json = JSON.parse(payload);

    let limit = 10;
    let isAuthoritative = true;
    let label = json['aLabel'];
    let minSize = 0;
    let maxSize = 100;
    //let matches: nkruntime.Match[] = [];

    var matches = nk.matchList(limit, isAuthoritative, label, minSize, maxSize, "");

    // If matches exist, sort by match size and return the largest.
    let vIndex = -1;
    if (matches.length > 0)
    {

        for (let vI = 0; vI < matches.length; vI++)
        {
            if (matches[vI].label == label)
            {
                vIndex = vI;
                break;
            }
        }
    }

    if (vIndex > -1)
    {
        logger.warn('Found existing match');
        return matches[vIndex].matchId;
    }
    else
    {
        var matchId = nk.matchCreate("lobby", { "label": label });
        return JSON.stringify({ matchId });
    }
}

```

When I try to compile this typescript code the compiler returns:

```auto
rpcLSfindOrCreateMatch.ts:21:29 - error TS2339: Property 'Label' does not exist on type 'Match'.

21 if (matches[vI].Label == label)
                               ~~~~~

```

Is it possible that I’m wrong something like, for example, I don’t include definitions or anything else?

The property **matchID** is recognized but no LABEL.

What’s wrong?  
thank you

---

<div class="post-metadata">

**Author:** ![flavio](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/flavio/32/2161_2.png) [@flavio](https://forum.heroiclabs.com/u/flavio)\
**Post date:** [May 23, 2022, 2:05pm UTC](https://forum.heroiclabs.com/t/accessing-match-properties-in-rpc-functions/2657/2 "2022-05-23T14:05:04Z")

</div>

Hello @solidsnakeit

The fix for the missing ‘label’ field on the Match structure has already landed ([Add missing label to TS match definition. (#74) · heroiclabs/nakama-common@27fe749 · GitHub](https://github.com/heroiclabs/nakama-common/commit/27fe74908922442be7c4d8e212fb99d5f38c3266)), so if you upgrade the package to the latest version/commit you should see it.

You may need to remove the package and reinstall it to see the effects of the fix.

---

<div class="post-metadata">

**Author:** ![solidsnakeit](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@solidsnakeit](https://forum.heroiclabs.com/u/solidsnakeit)\
**Post date:** [May 23, 2022, 2:28pm UTC](https://forum.heroiclabs.com/t/accessing-match-properties-in-rpc-functions/2657/3 "2022-05-23T14:28:33Z")

</div>

YES! It works. Thank you very much. 🙂
