Closed
Description
Hi. I am trying to use React-Router with React 0.13.2.
The following is valid typescript, compiles and performs as expected - but only if i widden routes to 'any'.
var Route = React.createFactory(Router.Route)
...
var routes = Route({path: "/", handler: MyReactComponent}, ...)
Router.run(<any>routes, Router.HistoryLocation, handler)
If I remove <any> I get, "Argument of type 'ReactElement<RouteProp>' is not assignable to parameter of type 'Route'.
I can't figure out whether I am using the Router in the wrong way, or the migration to React 0.13 clash with the type declarations. I would be much obliged if you could help me solve the question.
-- Cheers
Metadata
Metadata
Assignees
Labels
No labels
Activity
[-]Mismatch, wrong type for Route?[/-][+]react-router: Mismatch, wrong type for Route?[/+]vvakame commentedon May 6, 2015
https://github.com/borisyankov/DefinitelyTyped/blob/master/react-router/react-router.d.ts#L3
please contact to definition author. @mrk21
tugend commentedon May 7, 2015
Will do, thank you.
Fix `Router#run()` to be enabled to call with `ReactElement` created …
mrk21 commentedon May 10, 2015
Hi @tugend,
The reason this issue was occurred is that
Router.run()does not support to call withReactElementcreated byReact.createFactory().Therefore, I fixed it.
If the following pull request is merged, you will be able to remove
<any>from the above code.duncanmak commentedon Jun 6, 2015
@tugend You might want to try #4173 and see if that works better or not.
tugend commentedon Jun 6, 2015
Thank you for the suggestion, but @mrk21 fixed the problem (always the champ!). =)