I have several NPM codebases that use Firestore. One is client-side, one is server-side, and I am trying to refactor some code to a common dependency codebase. The server codebase uses firebase-admin as its dependency, but if I try to set objects with sentinel types (e.g. firebase.firestore.Timestamp), I incur this error:
Please ensure that the Firestore types you are using are from the same NPM package
I can avoid mixing firestore implementations by injecting the instance into my library codebase, e.g.:
import * as admin from "firebase-admin";
const libraryCode = new MyFirestoreLibrary(admin.firestore())
But, are there ways to access these sentinel types in library code?
An example of what I'm hoping to make work is here: https://github.com/okhobb/firestore-dependency-tester