I am trying to read data from Firestore into my TypeScript Project.
In Firestore I have a Map under the field mapName
The following data structure I got while using JSON.stringify(change.after.data())
const test: Test = {
mapName: {
"v3mioXc3VoFgfj0WEq": {
isNormalSubscription: false,
},
"as12oXc3VoFas12WEq": {
isNormalSubscription: true,
},
},
};
interface Test {
mapName: Map<string, any>
}
I am getting though the following error:
Type '{ v3mioXc3VoFgfj0WEq: { isNormalSubscription: false; }; }' is not assignable to type 'Map<string, any>'.
Object literal may only specify known properties, and '"v3mioXc3VoFgfj0WEq"' does not exist in type 'Map<string, any>'.
Since v3mioXc3VoFgfj0WEq
and as12oXc3VoFas12WEq
are Firestore Keys that I do not know beforehand, how should I change my Test interface to properly manage the data?