Skip to content

Commit

Permalink
docs: improve withRouter hoc types (#463)
Browse files Browse the repository at this point in the history
  • Loading branch information
lneves12 committed Apr 21, 2020
1 parent 10576b9 commit b79f999
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/react-router5/modules/hocs/withRouter.tsx
@@ -1,11 +1,11 @@
import React, { SFC, ComponentType } from 'react'
import React, { ComponentType } from 'react'
import { Router } from 'router5'
import { routerContext } from '../context'

function withRouter<P>(
BaseComponent: ComponentType<P & { router: Router }>
): SFC<Exclude<P, 'router'>> {
return function WithRouter(props) {
): ComponentType<Omit<P, 'router'>> {
return function WithRouter(props: P) {
return (
<routerContext.Consumer>
{router => <BaseComponent {...props} router={router} />}
Expand Down

0 comments on commit b79f999

Please sign in to comment.