According the HashMap documentation the module exposes function keys and vals but, when I build I get following error:
storage.store.mo:74.42-74.48: type error [M0072], field keys does not exist in type
{
delete : Text → ();
entries : () → Iter/1<(Text, Asset/1)>;
get : Text → ?Asset/1;
put : (Text, Asset/1) → ();
remove : Text → ?Asset/1;
replace : (Text, Asset/1) → ?Asset/1;
size : () → Nat
}
Likewise, when I try the following in the motoko playground got the same error.
import HashMap "mo:base/HashMap";
import Iter "mo:base/Iter";
import Text "mo:base/Text";
actor Echo {
private var assets: HashMap.HashMap<Text, Text> = HashMap.HashMap<Text, Text>(
0, Text.equal, Text.hash,
);
// Say the given phase.
public query func say() : async [Text] {
let keys: Iter.Iter<Text> = assets.keys(); // <-- same error
return Iter.toArray(keys);
};
};
Documentation is incorrect or am I missing something ?
Is there a quick way to get all keys?