connected-react-router icon indicating copy to clipboard operation
connected-react-router copied to clipboard

TypeScript: Error in history type

Open hazratgs opened this issue 6 years ago • 1 comments

Hi, I have a cra project on typescript, added the connected-react-router to it, the first step:

`// reducers.js import { combineReducers } from 'redux' import { connectRouter } from 'connected-react-router'

export default (history) => combineReducers({ router: connectRouter(history), ... // rest of your reducers })`

After adding this code, an error occurs: Parameter 'history' implicitly has an 'any' type.

I do not really want to register any, please tell me which type to register there?

hazratgs avatar May 31 '19 16:05 hazratgs

Hey there! First, npm i --save @types/history, and then try doing this:

import { History } from 'history'

eordano avatar Oct 14 '19 23:10 eordano