You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{combineReducers}from'redux'import{routerReducerasrouter}from'react-router-redux'constrootReducer=combineReducer<IState>({
router,
...otherReducers})/*export interface Action { type: any;}export interface AnyAction extends Action { // Allows any extra properties to be defined in an action. [extraProps: string]: any;}export interface RouterAction extends Action { type: typeof CALL_HISTORY_METHOD; payload: LocationActionPayload;}Error:Type 'AnyAction' is not assignable to type 'RouterAction'.Property 'payload' is missing in type 'AnyAction'.*/
Expected behavior:
Maybe no error?
I'm not sure if there's any graceful solution to this problem, I mean without using 'any' type assertion. Actual behavior:
Type 'AnyAction' is not assignable to type 'RouterAction'.
Property 'payload' is missing in type 'AnyAction'.
The text was updated successfully, but these errors were encountered:
Why aren't you just using any instead of AnyAction, since they are exactly the same? I don't understand why AnyAction exists at all when you typed it to mean: "objects that are assignable to this interface can have any properties".
Is it just because AnyAction gives you code completion for "type"?
In any case, I wouldn't want the language to allow this as it would make indexed types useless (they would all turn into type any)
TypeScript Version: 2.4.1
Code
Expected behavior:
Maybe no error?
I'm not sure if there's any graceful solution to this problem, I mean without using 'any' type assertion.
Actual behavior:
Type 'AnyAction' is not assignable to type 'RouterAction'.
Property 'payload' is missing in type 'AnyAction'.
The text was updated successfully, but these errors were encountered: