Syntax Erro (Trie2D Put Method)

I am trying to make a Trie2D :

var containerChunk : Trie2D.Trie2D<Nat32, Nat32, [Nat32]> = Trie.empty();

Now , I have to update this containerChunk, with this given key (Nat32) and for value (Nat32, [Nat32]) ,
So I am finding Trie with given key using :

var chunk = Trie2D.find(containerChunk, key(pId), Nat32.equal);

and then I want to update this Trie , by putting (Key, Value)pair in it using :

chunk :=  Trie.put(chunk, key(chunkId), Nat32.equal, chunkData).0;

But Last method of updating it is giving error :

cannot implicitly instantiate function of type
<K, V>(Trie/351<K, V>, Key/351, (K, K) → Bool, ?V) →
(Trie/351<K, V>, ?V)
to argument of type
(?Trie/351<Nat32, Nat32>, Key/351, (Nat32/646, Nat32/646) → Bool,
[Nat32])
because no instantiation of K/38405, V/39801 makes
(?Trie/351<Nat32, Nat32>, Key/351, (Nat32/646, Nat32/646) → Bool,
[Nat32]) <:
(Trie/351<K/38405, V/39801>, Key/351<K/38405>,
(K/38405, K/38405) → Bool, ?V/39801)

Please Help.

The Trie.put function requires you to provide type parameters to it

so I believe this should work…

chunk := Trie.put<Nat32, [Nat32]>(chunk, key(chunkId), Nat32.equal, chunkData).0;

Or whatever type you expect your <K, V> to be.

Not Working , still showing error :

expression of type
  Trie/357<Nat32, [Nat32]> = {
                               #branch : Branch/357<Nat32, [Nat32]>;
                               #empty;
                               #leaf : Leaf/357<Nat32, [Nat32]>
                             }
cannot produce expected type
  ?Trie/357<Nat32, Nat32>

Ah, well now it’s just saying that you have a mismatch between an option type that could be null ?, and a type that will return a value every time

You also have a type mismatch between the value [Nat] vs Nat.

The error message is essentially telling you this.

so what should i do to remove type mismatch between a option type and value that will get returned?

Or to remove this Error?

expression of type
  Trie/431<Nat32, [Nat32]> = {
                               #branch : Branch/431<Nat32, [Nat32]>;
                               #empty;
                               #leaf : Leaf/431<Nat32, [Nat32]>
                             }
cannot produce expected type
  ?Trie/431<Nat32, [Nat32]>

See this link I posted above. It shows how to construct an option type, and how to deconstruct an option type via pattern matching.