Skip to content

Commit eefc2bb

Browse files
Cast collectionData to avoid TS errors (#3434)
* Cast collectionData to avoid TS errors Using the current code example, I am getting an error message Typescript error message like: ``` Type 'Observable<(DocumentData | (DocumentData & { .... }))[]>' is not assignable to type 'Observable<Item[]>'. ``` This change also makes this code example more consistent with the current example in [firestore.md](https://github.com/angular/angularfire/blob/5793d6f3a15aa61660af75ab361c534cde9b73df/docs/firestore.md?plain=1#L91) * accept reviewer's suggestion --------- Co-authored-by: James Daniels <[email protected]>
1 parent 2b0ce92 commit eefc2bb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class AppComponent {
5858

5959
constructor() {
6060
const itemCollection = collection(this.firestore, 'items');
61-
this.item$ = collectionData(itemCollection) as Observable<Item[]>;
61+
this.item$ = collectionData<Item>(itemCollection);
6262
}
6363
}
6464
```

0 commit comments

Comments
 (0)