Skip to content
CCPEDIAby Unity Nodes
App Development

Creating a Map of type damlTypes.Map<string, damlTypes.Party>

3 posts238 views1 likesLast activity Oct 2023

  1. Joao_FreitasOP

    Hi everyone :slight_smile:

    on my project i am trying to create a Map of the following type damlTypes.Map<string, damlTypes.Party> (imported from the @daml/types lib).

    But it keeps throwing me an error pointing that the " Property ‘entriesArray’ is missing"

    I am doing it this way:

    const myMap: damlTypes.Map<string, damlTypes.Party> = new Map(),
    myMap.set("","");
    

    any help would be appreciated on how to create MapImpl (MapImpl |) on the FE.

    Thanks :slight_smile:

  2. Stephen 1
    const myMap: damlTypes.Map<string, damlTypes.Party> = new Map(),
    

    In this line of code, Map is a totally unrelated type to damlTypes.Map. That error takes the form of pointing out that your property sets don’t match up correctly, as damlTypes.Map is a purely structural type.

    MapImpl is not exported. In the public exports of @daml/types you’ll find the emptyMap function; this is a good starting point.

  3. Joao_Freitas

    Thank Stephen, yes on the meanwhile i opened the daml/types lib and found that.

     const empty = damlTypes.emptyMap<string, damlTypes.Party>()
    

    solved my problem and then added the needed info with the .set() method.

    Thanks :slight_smile: