-
Notifications
You must be signed in to change notification settings - Fork 989
Closed
Closed
Copy link
Labels
Description
Describe your environment
- Operating System version: Debian 11
- Browser version: Chrome 111.0.5563.64
- Firebase SDK version:
- firebase: 9.16.0
- firebase-admin: 11.5.0
- Firebase Product: database (firestore)
Describe the problem
There are two NPM packages: firebase, which is mostly used in Web frontend applications, and firebase-admin, which is usually used in backend NodeJS functions.
- The
firebasepackage is using@firebase/firestore, which has the next code forDocumentSnapshot:
export declare class DocumentSnapshot<T = DocumentData> {
/**
* Returns whether or not the data exists. True if the document exists.
*/
exists(): this is QueryDocumentSnapshot<T>;
}
- The
firebase-adminpackage is using@google/cloud, which has the next code forDocumentSnapshot:
export class DocumentSnapshot<T = DocumentData> {
/** True if the document exists. */
readonly exists: boolean;
In the first case exists field is a function, while in the second case it is a boolean field.
It would be nice to have some API consistency for the both cases. It will also simplify a bit helper classes writing, currently it requires checks for a field type to make a switch.