Skip to content

Commit

Permalink
improve typescript definitions for immutable
Browse files Browse the repository at this point in the history
  • Loading branch information
thomschke authored and supasate committed Sep 23, 2018
1 parent b79db5f commit 4522886
Showing 1 changed file with 3 additions and 58 deletions.
61 changes: 3 additions & 58 deletions immutable.d.ts
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
}

0 comments on commit 4522886

Please sign in to comment.