Skip to content

Typescript error: Type 'unknown' is not assignable to type 'never' #4076

Closed
@Guymestef

Description

@Guymestef

What is the current behavior?

Redux set never as type instead of unknown:

The types of 'router.location.state' are incompatible between these types.
Type 'unknown' is not assignable to type 'never'.

Steps to Reproduce

import { connectRouter, LocationChangeAction, RouterState } from 'connected-react-router';
import { History } from 'history';
import { applyMiddleware, combineReducers, compose, createStore, Store, CombinedState, AnyAction } from 'redux';

export type ApplicationState = { router: RouterState };

const createRootReducer = (history: History) => combineReducers({
    router: connectRouter(history),
});

export default function configureStore(history: History, initialState?: ApplicationState): Store<CombinedState<any>, AnyAction | LocationChangeAction<any>> {
    const store = createStore(
        createRootReducer(history), // root reducer with router state
        initialState,
    );

    return store;
}

What is the expected behavior?

Use unknown instead of never

Environment Details

Redux 4.1.0
Chrome
Windows 10
Did this work in previous versions of Redux? Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions