I'm trying to check if a Map contains a value. I tested this code in typescript playground.
let userMap = new Map();
userMap.set("user1", 'displayName');
userMap.set("user2", 'displayName2');
console.log(friendsMapNew.has("user2")); //true
But when I use this code in a google cloud function I get this error:
error TypeError: userMap.has is not a function
This is the code I use in the cloud function.
let userMap = new Map();
userMap = getUserDocument.data()['userMap']; //if i console.log this, it shows a map like this:
{ K79DFS: 'Bob' }
if (userMap.has("Bob") === true) {console.log("user exists")}
What am I doing wrong?
Thanks!