Skip to content

Typescript: firestore: FirestoreReducer.Reducer; No overload matches this call. #310

Open
@SamPoate

Description

Hi all, current issue lies below. Thanks in advance for the help.

What is the current behavior?

(property) firestore: Reducer<FirestoreReducer.Reducer, any>
No overload matches this call.
  Overload 1 of 3, '(reducers: ReducersMapObject<AppState, any>): Reducer<CombinedState<AppState>, AnyAction>', gave the following error.
    Type 'typeof firestoreReducer' is not assignable to type 'Reducer<Reducer, any>'.
      Types of parameters 'state' and 'state' are incompatible.
        Type 'Reducer | undefined' is not assignable to type 'object'.
          Type 'undefined' is not assignable to type 'object'.
  Overload 2 of 3, '(reducers: ReducersMapObject<AppState, AnyAction>): Reducer<CombinedState<AppState>, AnyAction>', gave the following error.
    Type 'typeof firestoreReducer' is not assignable to type 'Reducer<Reducer, AnyAction>'.
      Types of parameters 'state' and 'state' are incompatible.
        Type 'Reducer | undefined' is not assignable to type 'object'.
          Type 'undefined' is not assignable to type 'object'.ts(2769)
rootReducer.ts(13, 5): The expected type comes from property 'firestore' which is declared here on type 'ReducersMapObject<AppState, any>'
rootReducer.ts(13, 5): The expected type comes from property 'firestore' which is declared here on type 'ReducersMapObject<AppState, AnyAction>'

What is the expected behavior?

Which version of redux-firestore are you using? What about other dependencies?
"react-redux-firebase": "^3.7.0",
"redux-firestore": "^0.14.0",
"@reduxjs/toolkit": "^1.4.0",

Which environments/browsers are affected by this issue? Did this work in previous versions or setups?
N/A

Minimal demo to reproduce issue (using codesandbox or similar)

import { Reducer, combineReducers } from '@reduxjs/toolkit';
import { TypedUseSelectorHook, useSelector } from 'react-redux';
import {
    firebaseReducer,
    FirebaseReducer,
    FirestoreReducer
} from 'react-redux-firebase';
import { firestoreReducer } from 'redux-firestore';
import { IProfile } from '../types';

type AppState = {
    firebase: FirebaseReducer.Reducer<IProfile>;
    firestore: FirestoreReducer.Reducer;
};

const rootReducer: Reducer<AppState> = combineReducers<AppState>({
    firebase: firebaseReducer,
    firestore: firestoreReducer
});

export type RootState = ReturnType<typeof rootReducer>;
export const useTypedSelector: TypedUseSelectorHook<RootState> = useSelector;

export default rootReducer;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions