Skip to content

Commit

Permalink
Merge pull request DefinitelyTyped#8776 from GiedriusGrabauskas/patch-4
Browse files Browse the repository at this point in the history
Updated react-router 2.0
  • Loading branch information
horiuchi committed Mar 31, 2016
2 parents 0b735f4 + e42fc3e commit ee6e843
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions react-router/react-router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,23 @@ declare namespace ReactRouter {

type Component = React.ReactType

type EnterHook = (nextState: RouterState, replaceState: RedirectFunction, callback?: Function) => any
type EnterHook = (nextState: RouterState, replace: RedirectFunction, callback?: Function) => void

type LeaveHook = () => any
type LeaveHook = () => void

type ChangeHook = (prevState: RouterState, nextState: RouterState, replace: RedirectFunction, callback: Function) => void;

type Params = Object
type Params = { [param: string]: string }

type ParseQueryString = (queryString: H.QueryString) => H.Query

type RedirectFunction = (state: H.LocationState, pathname: H.Pathname | H.Path, query?: H.Query) => void
interface RedirectFunction {
(location: H.LocationDescriptor): void;
/**
* @deprecated `replaceState(state, pathname, query) is deprecated; Use `replace(location)` with a location descriptor instead. http://tiny.cc/router-isActivedeprecated
*/
(state: H.LocationState, pathname: H.Pathname | H.Path, query?: H.Query): void;
}

type RouteComponent = Component

Expand Down Expand Up @@ -98,7 +106,7 @@ declare namespace ReactRouter {
activeStyle?: React.CSSProperties
activeClassName?: string
onlyActiveOnIndex?: boolean
to: RoutePattern
to: RoutePattern | H.LocationDescriptor
query?: H.Query
state?: H.LocationState
}
Expand Down Expand Up @@ -138,6 +146,7 @@ declare namespace ReactRouter {
getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void
onEnter?: EnterHook
onLeave?: LeaveHook
onChange?: ChangeHook
getIndexRoute?: (location: H.Location, cb: (error: any, indexRoute: RouteConfig) => void) => void
getChildRoutes?: (location: H.Location, cb: (error: any, childRoutes: RouteConfig) => void) => void
}
Expand Down

0 comments on commit ee6e843

Please sign in to comment.