Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Usage with TypeScript #48

@mehmetnyarar

Description

@mehmetnyarar

I'm trying to figure out how to use react-intl-redux with TypeScript.

I've tried this:

import { combineReducers, AnyAction } from "redux";
import { intlReducer, IntlState } from "react-intl-redux";

export type AppState = {
  intl: IntlState;
};

export type AppAction = AnyAction;

export default combineReducers<AppState>({
  intl: intlReducer
});

But I've got a warning:

Argument of type '{ intl: (state: IntlState, action: IntlAction) => IntlState; }' is not assignable to parameter of type 'ReducersMapObject<AppState, AnyAction>'.
Types of property 'intl' are incompatible.
Type '(state: IntlState, action: IntlAction) => IntlState' is not assignable to type 'Reducer<IntlState, AnyAction>'.
Types of parameters 'state' and 'state' are incompatible.
Type 'IntlState | undefined' is not assignable to type 'IntlState'.
Type 'undefined' is not assignable to type 'IntlState'.
(alias) function intlReducer(state: IntlState, action: IntlAction): IntlState
import intlReducer

Could you please help me out about this?

Metadata

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