Closed tlserver closed 6 months ago
FYI VueFirestoreDocumentData
already includes null
. This is likely related to your converter not being correctly typed. If it can return null
, it should be a possibility in withConverter<T>
. If typed correctly, it works:
BTW, your codesandbox is read only, when opening issues make sure to share writable playgrounds
Reproduction
codeSandbox
Steps to reproduce the bug
No step required.
count: null
is displayed on startup.Expected behavior
In https://github.com/vuejs/vuefire/blob/main/src/firestore/index.ts#L75-L104
The return type of useDocument should be
_RefFirestore<VueFirestoreDocumentData<T> | null | undefined>
but not_RefFirestore<VueFirestoreDocumentData<T> | undefined>
, since it return a null reference if document does not exist.This code,
doc.value !== null
, should be valid and have no warning.Actual behavior
IDE warn at
doc.value !== null
Additional information
No response