typescript definition for react-router v2.0 - error `has no exported member 'browserHistory'`
Asked Answered
M

2

6

I am using react-router v.2.0.0.-rc3 and typescript. I installed the definition file via tsd. Since they changed the browserHistory from beeing a mixin to a module, I get the error Module '"react-router"' has no exported member 'browserHistory' on my terminal when compiling the javascript via webpack. Is there an easy way I can modify the react-router.d.ts file to fix the error? Or do I just have to wait until they update the definition file? My app is working fine, it is just the console-error that bugs me.

Monroe answered 8/1, 2016 at 9:44 Comment(2)
Sorry missed the typescript part! Do you need middleware to import any JS module in typescript!?Impeccable
yes, the current file for react-router is here: github.com/DefinitelyTyped/DefinitelyTyped/blob/master/…Monroe
M
1

Awesome James Brantly pointed out that there is already an pullrequrest for v2.x. I used and all the errors are gone!

Monroe answered 8/1, 2016 at 16:32 Comment(0)
H
0

Installing the version 3 of the types solved the problem.

npm install --save-dev @types/[email protected]
Hewitt answered 21/2, 2020 at 1:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.