-
Notifications
You must be signed in to change notification settings - Fork 592
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve typescript definitions for immutable
- Loading branch information
Showing
1 changed file
with
3 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,7 @@ | ||
declare module 'connected-react-router/immutable' { | ||
import * as React from 'react' | ||
import { Middleware, Reducer } from 'redux' | ||
import { History, Path, Location, LocationState, LocationDescriptorObject } from 'history' | ||
|
||
interface ConnectedRouterProps { | ||
history: History | ||
} | ||
|
||
export enum RouterActionType { | ||
POP = 'POP', | ||
PUSH = 'PUSH' | ||
} | ||
|
||
export interface LocationChangeAction { | ||
type: typeof LOCATION_CHANGE; | ||
payload: RouterState; | ||
} | ||
|
||
export interface RouterState { | ||
location: Location | ||
action: RouterActionType.POP | RouterActionType.PUSH | ||
} | ||
|
||
export const LOCATION_CHANGE: '@@router/LOCATION_CHANGE' | ||
export const CALL_HISTORY_METHOD: string | ||
|
||
export function push(path: Path, state?: LocationState): RouterAction; | ||
export function push(location: LocationDescriptorObject): RouterAction; | ||
export function replace(path: Path, state?: LocationState): RouterAction; | ||
export function replace(location: LocationDescriptorObject): RouterAction; | ||
export function go(n: number): RouterAction | ||
export function goBack(): RouterAction | ||
export function goForward(): RouterAction | ||
/// <reference path="./index.d.ts"/> | ||
|
||
export const routerActions: { | ||
push: typeof push, | ||
replace: typeof replace, | ||
go: typeof go, | ||
goBack: typeof goBack, | ||
goForward: typeof goForward, | ||
} | ||
|
||
export interface LocationActionPayload { | ||
method: string; | ||
args?: any[]; | ||
} | ||
|
||
export interface RouterAction { | ||
type: typeof CALL_HISTORY_METHOD; | ||
payload: LocationActionPayload; | ||
} | ||
|
||
export class ConnectedRouter extends React.Component<ConnectedRouterProps, {}> { | ||
|
||
} | ||
declare module 'connected-react-router/immutable' { | ||
|
||
export function connectRouter(history: History) | ||
: <S>(reducer: Reducer<S>) => Reducer<S> | ||
export * from 'connected-react-router'; | ||
|
||
export function routerMiddleware(history: History): Middleware | ||
} |