Return types updated from undefined to void in react-router and react… (#14743)

* Return types updated from undefined to void in react-router and react-router-redux.

* Author added to definitions.
This commit is contained in:
Dovydas Navickas 2017-03-11 02:02:02 +02:00 committed by Mohamed Hegazy
parent 1636a8e3aa
commit df4cd9221a
8 changed files with 20 additions and 19 deletions

View File

@ -1,6 +1,6 @@
// Type definitions for react-router-redux 4.0
// Project: https://github.com/rackt/react-router-redux
// Definitions by: Isman Usoh <http://github.com/isman-usoh>, Noah Shipley <https://github.com/noah79>, Dimitri Rosenberg <https://github.com/rosendi>, Karol Janyst <https://github.com/LKay>
// Definitions by: Isman Usoh <http://github.com/isman-usoh>, Noah Shipley <https://github.com/noah79>, Dimitri Rosenberg <https://github.com/rosendi>, Karol Janyst <https://github.com/LKay>, Dovydas Navickas <https://github.com/DovydasNavickas>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
@ -51,7 +51,7 @@ export interface SyncHistoryWithStoreOptions {
}
export interface HistoryUnsubscribe {
unsubscribe(): undefined;
unsubscribe(): void;
}
export function routerReducer(state?: RouterState, action?: Action): RouterState;

View File

@ -34,8 +34,8 @@ export interface RouteActions {
}
export interface HistoryMiddleware extends Redux.Middleware {
listenForReplays(store: Redux.Store<any>, selectLocationState?: Function): undefined;
unsubscribe(): undefined;
listenForReplays(store: Redux.Store<any>, selectLocationState?: Function): void;
unsubscribe(): void;
}
export function routeReducer(state?: any, options?: any): Redux.Reducer<any>;

View File

@ -8,6 +8,7 @@
// Kostya Esmukov <https://github.com/KostyaEsmukov>
// John Reilly <https://github.com/johnnyreilly>
// Karol Janyst <https://github.com/LKay>
// Dovydas Navickas <https://github.com/DovydasNavickas>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1

View File

@ -15,8 +15,8 @@ type ComponentsCallback = (err: any, components: RouteComponents) => any;
export interface IndexRouteProps {
component?: RouteComponent;
components?: RouteComponents;
getComponent?(nextState: RouterState, callback: ComponentCallback): undefined;
getComponents?(nextState: RouterState, callback: ComponentsCallback): undefined;
getComponent?: (nextState: RouterState, callback: ComponentCallback) => void;
getComponents?: (nextState: RouterState, callback: ComponentsCallback) => void;
onEnter?: EnterHook;
onChange?: ChangeHook;
onLeave?: LeaveHook;

View File

@ -20,12 +20,12 @@ declare const Route: Route;
export default Route;
type RouteCallback = (err: any, route: PlainRoute) => any;
type RoutesCallback = (err: any, routesArray: PlainRoute[]) => any;
type RouteCallback = (err: any, route: PlainRoute) => void;
type RoutesCallback = (err: any, routesArray: PlainRoute[]) => void;
export interface PlainRoute extends RouteProps {
childRoutes?: PlainRoute[];
getChildRoutes?(partialNextState: LocationState, callback: RoutesCallback): undefined;
getChildRoutes?: (partialNextState: LocationState, callback: RoutesCallback) => void;
indexRoute?: PlainRoute;
getIndexRoute?(partialNextState: LocationState, callback: RouteCallback): undefined;
getIndexRoute?: (partialNextState: LocationState, callback: RouteCallback) => void;
}

View File

@ -36,8 +36,8 @@ export type ChangeHook = (prevState: RouterState, nextState: RouterState, replac
export type RouteHook = (nextLocation?: Location) => any;
export interface RedirectFunction {
(location: LocationDescriptor): undefined;
(state: LocationState, pathname: Pathname | Path, query?: Query): undefined;
(location: LocationDescriptor): void;
(state: LocationState, pathname: Pathname | Path, query?: Query): void;
}
export interface RouterState {
@ -47,11 +47,11 @@ export interface RouterState {
components: RouteComponent[];
}
type LocationFunction = (location: LocationDescriptor) => any;
type GoFunction = (n: number) => any;
type NavigateFunction = () => any;
type LocationFunction = (location: LocationDescriptor) => void;
type GoFunction = (n: number) => void;
type NavigateFunction = () => void;
type ActiveFunction = (location: LocationDescriptor, indexOnly?: boolean) => boolean;
type LeaveHookFunction = (route: any, callback: RouteHook) => any;
type LeaveHookFunction = (route: any, callback: RouteHook) => void;
type CreatePartFunction<Part> = (path: Path, query?: any) => Part;
export interface InjectedRouter {

View File

@ -18,6 +18,6 @@ interface MatchHistoryArgs extends MatchArgs {
history: History;
}
export type MatchCallback = (error: any, redirectLocation: Location, renderProps: any) => any;
export type MatchCallback = (error: any, redirectLocation: Location, renderProps: any) => void;
export default function match(args: MatchLocationArgs | MatchHistoryArgs, cb: MatchCallback): undefined;
export default function match(args: MatchLocationArgs | MatchHistoryArgs, cb: MatchCallback): void;

View File

@ -27,7 +27,7 @@ import { createHistory, History } from "history";
const routerHistory = useRouterHistory(createHistory)({ basename: "/test" });
interface CustomHistory {
test(): undefined;
test(): void;
}
type CombinedHistory = History & CustomHistory;