Encountering a problem while running the function val.set(key, value)
, resulting in a type error
TypeError: val.set is not a function
within the file vendor-es2015.js
.
Here's the simplified code snippet:
import { Storage } from '@ionic/storage';
map = new Map();
this.storage.set('sth', map);
this.storage.get('sth').then((val) => {
val.set(key, value); //TypeError, returns {} instead of a map.
});
An interesting observation is that this issue arises only after compiling for Android with Capacitor, as it works without any errors in browsers.
tsconfig.json
"target": "es2015",
"lib": [
"es2018",
"dom"
]