-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
The DocumentReference type is wrapping the same type from firestore in a way that hides the generic type.
// original class
export class DocumentReference<T = DocumentData> {
// ...
}
// angularfire's proxied type
export declare type DocumentReference = firestore.DocumentReference;I would suggest also proxying the generic parameter like so:
export declare type DocumentReference<T = DocumentData> = firestore.DocumentReference<T>;I didn't check everywhere that this model is used, but usages would also need to be adjusted. For example:
// current implementation
export class AngularFirestoreCollection<T = DocumentData> {
add(data: T): Promise<DocumentReference>;
}
// my suggested change
export class AngularFirestoreCollection<T = DocumentData> {
add(data: T): Promise<DocumentReference<T>>;
}This would allow for much better type safety when working with the DocumentReference model.
jits and yasinkocak
Metadata
Metadata
Assignees
Labels
No labels