refactor(firestore): improve firestore types and add test
Description
#8611 flaged that many types are currently broken.
This PR fixes most of the type issues by removing <AppModelType, DbModelType> and replaced with <T extends DocumentData>.
Also added tsd to make sure our .d.ts are legit. Fixed many issues thanks to it!
Related issues
#8611
Release Summary
Fix types for firestore
Checklist
- I read the Contributor Guide and followed the process outlined there for submitting PRs.
- [x] Yes
- My change supports the following platforms;
- [ ]
Android - [ ]
iOS - [ ]
Other(macOS, web)
- [ ]
- My change includes tests;
- [ ]
e2etests added or updated inpackages/\*\*/e2e - [ ]
jesttests added or updated inpackages/\*\*/__tests__
- [ ]
- [x] I have updated TypeScript types that are affected by my change.
- This is a breaking change;
- [ ] Yes
- [x] No
Test Plan
Added tsd to add some type testings to our apis.
Think react-native-firebase is great? Please consider supporting the project with any of the below:
- 👉 Star this repo on GitHub ⭐️
- 👉 Follow
React Native FirebaseandInvertaseon Twitter
The latest updates on your projects. Learn more about Vercel for GitHub.
| Project | Deployment | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| react-native-firebase | Preview | Comment | Sep 16, 2025 8:49am |
Hey there, any updates on this? Just got a runtime error as snapshot.exists() has become a method (I've recently upgraded from v21 to v23.3.1) and my code was still treating it as a property, and the types are now broken, so I got no type errors. Thanks!
Hello 👋, this PR has been opened for more than 2 months with no activity on it.
If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing!
You have 15 days until this gets closed automatically
Hey @mikehardy @ycmjason , any updates on this one? Let me know if I can help somehow. Thank you
Hello 👋, this PR has been opened for more than 2 months with no activity on it.
If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing!
You have 15 days until this gets closed automatically
I think something bigger is about to happen - we've got a PR landing with long-awaited withConverter support
However, it will affect these firestore types deeply - could I ask an interested party here @ycmjason or @cbdeveloper to have a look at that and see what you think? The implementation there looks right but I'm unsure if it's a breaking change or not. The types appear to have fidelity with upstream firebase-js-sdk so they seem more correct to me but if they are breaking I want to make sure we release a major version with warning and explanation for everyone
And of course if I'm wrong in any of that analysis or assumptions please let me know 🙌
@mikehardy please count me in!