vuejs / vuefire

🔥 Firebase bindings for Vue.js
https://vuefire.vuejs.org
MIT License
3.82k stars 323 forks source link

Realtime Database does not allow `null` despite docs? #1450

Closed chrisspiegl closed 7 months ago

chrisspiegl commented 8 months ago

Expected behavior

Docs mentions that we can also return null as a reference and use it in the useDatabaseObject.

https://github.com/vuejs/vuefire/blob/c4deaee2166aba5180ba4437a13401ec5e4a3c24/docs/guide/realtime-data.md?plain=1#L98

However, there is a warning in my code that this is not compatible.

image

Actual behavior

Typescript warning as seen on the screenshot.

Additionally: it appears that the null value actually does work. So, I think it's just a type error that needs changing?

Additional information

This is how the useDocument is typed:

https://github.com/vuejs/vuefire/blob/c4deaee2166aba5180ba4437a13401ec5e4a3c24/src/firestore/index.ts#L87

This is how the useDatabaseObject is typed:

https://github.com/vuejs/vuefire/blob/c4deaee2166aba5180ba4437a13401ec5e4a3c24/src/database/index.ts#L57

posva commented 8 months ago

Feel free to give this a go if you want!