Cannot save value to dataset

export function getTypeId(typeName) {
return wixData.query(“Type”)
.eq(‘name’, typeName)
.find() // Run the query
.then(results => {
return results.items;
}). catch (error => {
console.log(error);
});
}

export function dataset2_itemValuesChanged() {
//Add your code for this event here:
let typeId;
let typeName = $w(‘#dropdown1’).value;

console.log("itemValuesChanged event fired.. "); 
getTypeId(typeName).then(items => { 

let firstItem = items[0];
typeId = firstItem[‘_id’];

        $w("#dataset2").setFieldValues({ 

“user_userid”: user.id,
“type_id”: typeId
});
})

}