Key() method in Trie.find() giving an error. bare in mind this exact method and key is used in the file in several other places with no error

here is the code implementation:

here is the key function:

here are the error messages :

The third argument should be a function with the following signature according to the docs:
k_eq : (K, K) -> Bool

I believe because you pass in a function call by specifying an argument, key(callerId) would be evaluted to type Trie.Key<Principal>.

But the main problem is probably that your updateJournal function takes a parameter called key : ?Nat which has precedence over the function declaration outside of the method, thus the type error (they key function and key parameter have the same name).

I’m on mobile so I can’t fact check this, hope it helps anyways!

3 Likes

You were indeed correct. I completely missed the fact that recycled that name. Thank you so much!

1 Like