Open
Description
Have we lost document typing with the upgrade to AngularFire 7?
In the past, we were able to do (as shown in the docs) something like afs.doc<Item>('items/1')
and that would return DocumentReference<Item>
as the type.
Now it looks like the functions that exist are
function doc(firestore: types.FirebaseFirestore, path: string, ...pathSegments: string[]): DocumentReference<DocumentData>;
function doc<T>(reference: types.CollectionReference<T>, path?: string, ...pathSegments: string[]): DocumentReference<T>;
function doc(reference: types.DocumentReference<unknown>, path: string, ...pathSegments: string[]): DocumentReference<DocumentData>;
The only one that is typed is the one that takes in a previous collection reference. Meanwhile, this first is the one we're directed to use in the upgrade documentation and it only uses DocumentData. One of the big benefits to using AngularFire previously over the vanilla Firebase libraries was the fact that DocumentData didn't have to be cast. Has that now been removed?
Metadata
Metadata
Assignees
Labels
No labels