I have the interfaces:
interface Item {
data: string
}
interface Test {
item: Item
url: string
}
My data in Firestore is stored as follows
Collection Tests
id: {
item: {
data: "some data"
},
url: "abc.com",
}
}
How can I type the incoming objects on a collection read?
this.db.collection('tests').valueChanges().subscribe(tests => {
// Do some sort of type conversion
});
Or better yet could I do something like this:
this.db.collection('tests').valueChanges().subscribe<Test[]>(tests => {
tests[0].url // valid typescript
});
itemwhich has a string property calleddata?itemis a Firestore Map with a keydata