Use shared TypeScript definitions for common types such as CollectionReference, DocumentReference, WhereFilterOp, etc.
See original GitHub issueI use Firestore both on the back-end and front-end environments. The problem is that the client library uses @firebase/firestore-types
package (https://github.com/firebase/firebase-js-sdk/blob/master/packages/firestore-types/index.d.ts) while in Node.js types are defined in @firebase/firestore
(https://github.com/googleapis/nodejs-firestore/blob/master/types/firestore.d.ts). For the most parts, the interfaces are identical, but because they’re defined individually, it prevents me from using shared helpers that I can use both in the browser and on the server.
For instance, I’m trying to create typed wrapper:
But I can’t make it work in both environments because it depends on defenition of CollectionReference
, DocumentReference
, WhereFilterOp
, etc:

Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:6 (1 by maintainers)
@kossnocorp this is great – Google, please consider adding this layer! Would be very helpful for all of us using Firebase on front end and back end.
@Robula yeah, I’ve built a universal wrapper for Firestore: https://github.com/kossnocorp/typesaurus