When I create the store and pass in my firebase config to reduxFirestore, I get a compilation error.
const store = createStore(rootReducer,
compose(
applyMiddleware(thunk.withExtraArgument({ getFirestore })),
reduxFirestore(firebase, firebaseConfig) // compilation error here
)
);
When I check the type of the argument otherConfig?: Partial<Config>,
it has nothing to do with the firebase params config type.
Config type from the redux-firestore index.d.ts (comments in code removed)
export interface Config {
enableLogging: boolean;
helpersNamespace: string | null;
logListenerError: boolean;
enhancerNamespace: string;
allowMultipleListeners:
| ((listenerToAttach: any, currentListeners: any) => boolean)
| boolean;
preserveOnDelete: null | object;
preserveOnListenerError: null | object;
onAttemptCollectionDelete:
| null
| ((queryOption: string, dispatch: Dispatch, firebase: Object) => void);
mergeOrdered: boolean;
mergeOrderedDocUpdate: boolean;
mergeOrderedCollectionUpdates: boolean;
}
The expected type to pass the firebase config in would be one that fits the firebase config object:
export const fbConfig = {
apiKey: "",
authDomain: "",
projectId: "",
storageBucket: "",
messagingSenderId: "",
appId: "",
measurementId: ""
};
If I do not pass anithing to the reduxFirestore
I get the error TypeError: firestore.collection is not a function
, guess because its not initialized properly.
How is the firebase config supossed to be passed to the reduxFirestore?
question from:
https://stackoverflow.com/questions/65870523/pass-in-firebase-config-to-reduxfirestore-typescript-typeerror-firestore-colle 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…