EddyVerbruggen / nativescript-plugin-firebase

:fire: NativeScript plugin for Firebase
https://firebase.google.com
MIT License
1.01k stars 448 forks source link

DocumentReference and DocumentSnapshot typings are missing a generic #1653

Open AnthonyLenglet opened 4 years ago

AnthonyLenglet commented 4 years ago

We've just ran into an issue that we hadn't noticed yet, the firestore.DocumentReference interface is missing a generic that is present in the firebase library

image

image

This missing caused a problem in this case, where discriminator was not required by in DocumentReference: image

I also noticed the same issue with DocumentSnapshot

await firestore().collection('hello').doc(id).get()

returns Promise<firebase.firestore.DocumentSnapshot>

when in firebase it returns Promise<DocumentSnapshot<T>> with T = DocumentData

/**
  * Reads the document referred to by this `DocumentReference`.
  *
  * Note: By default, get() attempts to provide up-to-date data when possible
  * by waiting for data from the server, but it may return cached data or fail
  * if you are offline and the server cannot be reached. This behavior can be
  * altered via the `GetOptions` parameter.
  *
  * @param options An object to configure the get behavior.
  * @return A Promise resolved with a DocumentSnapshot containing the
  * current document contents.
  */
get(options?: GetOptions): Promise<DocumentSnapshot<T>>;
BallisticPain commented 3 years ago

I've noticed the CollectionReference is also missing the generics that are available in the SDK. I'm not sure if this was intentional or this library hasn't been updated to include them.