mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 21:00:01 +08:00
Updated react-router 2.0
Added onchange hook. Updated all hooks. Params changed from object to dictionary. Changed to use location descriptor.
This commit is contained in:
19
react-router/react-router.d.ts
vendored
19
react-router/react-router.d.ts
vendored
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user