Replace void with undefined type

This commit is contained in:
Karol Janyst
2017-02-15 15:05:58 +09:00
parent dd54056ec3
commit 290b4f2339
6 changed files with 24 additions and 27 deletions

View File

@@ -51,7 +51,7 @@ export interface SyncHistoryWithStoreOptions {
}
export interface HistoryUnsubscribe {
unsubscribe(): void;
unsubscribe(): undefined;
}
export function routerReducer(state?: RouterState, action?: Action): RouterState;

View File

@@ -19,11 +19,11 @@ export const goForward: GoBackAction;
export const routeActions: RouteActions;
export type LocationDescriptor = History.LocationDescriptor;
export type PushAction = (nextLocation: LocationDescriptor) => void;
export type ReplaceAction = (nextLocation: LocationDescriptor) => void;
export type GoAction = (n: number) => void;
export type GoForwardAction = () => void;
export type GoBackAction = () => void;
export type PushAction = (nextLocation: LocationDescriptor) => undefined;
export type ReplaceAction = (nextLocation: LocationDescriptor) => undefined;
export type GoAction = (n: number) => undefined;
export type GoForwardAction = () => undefined;
export type GoBackAction = () => undefined;
export interface RouteActions {
push: PushAction;
@@ -34,11 +34,9 @@ export interface RouteActions {
}
export interface HistoryMiddleware extends Redux.Middleware {
listenForReplays(store: Redux.Store<any>, selectLocationState?: Function): void;
unsubscribe(): void;
listenForReplays(store: Redux.Store<any>, selectLocationState?: Function): undefined;
unsubscribe(): undefined;
}
export function routeReducer(state?: any, options?: any): Redux.Reducer<any>;
export function syncHistory(history: History.History): HistoryMiddleware;

View File

@@ -9,14 +9,14 @@ import {
RouterState
} from "react-router";
type ComponentCallback = (err: any, component: RouteComponent) => void;
type ComponentsCallback = (err: any, components: RouteComponents) => void;
type ComponentCallback = (err: any, component: RouteComponent) => undefined;
type ComponentsCallback = (err: any, components: RouteComponents) => undefined;
export interface IndexRouteProps {
component?: RouteComponent;
components?: RouteComponents;
getComponent?(nextState: RouterState, callback: ComponentCallback): void;
getComponents?(nextState: RouterState, callback: ComponentsCallback): void;
getComponent?(nextState: RouterState, callback: ComponentCallback): undefined;
getComponents?(nextState: RouterState, callback: ComponentsCallback): undefined;
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) => void;
type RoutesCallback = (err: any, routesArray: PlainRoute[]) => void;
type RouteCallback = (err: any, route: PlainRoute) => undefined;
type RoutesCallback = (err: any, routesArray: PlainRoute[]) => undefined;
export interface PlainRoute extends RouteProps {
childRoutes?: PlainRoute[];
getChildRoutes?(partialNextState: LocationState, callback: RoutesCallback): void;
getChildRoutes?(partialNextState: LocationState, callback: RoutesCallback): undefined;
indexRoute?: PlainRoute;
getIndexRoute?(partialNextState: LocationState, callback: RouteCallback): void;
getIndexRoute?(partialNextState: LocationState, callback: RouteCallback): undefined;
}

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

View File

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