mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-23 04:47:24 +08:00
Update some definitions based on history v2
This commit is contained in:
13
react-router/index.d.ts
vendored
13
react-router/index.d.ts
vendored
@@ -3,6 +3,19 @@
|
||||
// Definitions by: Sergey Buturlakin <https://github.com/sergey-buturlakin>, Yuichi Murata <https://github.com/mrk21>, Václav Ostrožlík <https://github.com/vasek17>, Nathan Brown <https://github.com/ngbrown>, Alex Wendland <https://github.com/awendland>, Kostya Esmukov <https://github.com/KostyaEsmukov>, Karol Janyst <https://github.com/LKay>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/* Replacement from old history definitions */
|
||||
export interface HistoryOptions {
|
||||
getCurrentLocation?(): Location;
|
||||
getUserConfirmation?(message: string, callback: (result: boolean) => void): void;
|
||||
pushLocation?(nextLocation: Location): void;
|
||||
replaceLocation?(nextLocation: Location): void;
|
||||
go?(n: number): void;
|
||||
keyLength?: number;
|
||||
}
|
||||
|
||||
export type CreateHistory<T> = (options?: HistoryOptions) => T;
|
||||
export type CreateHistoryEnhancer<T> = (createHistory: CreateHistory<T>) => CreateHistory<T>;
|
||||
|
||||
export {
|
||||
Basename,
|
||||
ChangeHook,
|
||||
|
||||
4
react-router/lib/Router.d.ts
vendored
4
react-router/lib/Router.d.ts
vendored
@@ -1,5 +1,6 @@
|
||||
import { Component, ComponentClass, ClassAttributes, ReactNode, StatelessComponent } from "react";
|
||||
import {
|
||||
Action,
|
||||
Hash,
|
||||
History,
|
||||
Href,
|
||||
@@ -11,12 +12,13 @@ import {
|
||||
} from "history";
|
||||
import { PlainRoute } from "react-router";
|
||||
|
||||
/* Replacement from old history definitions */
|
||||
export type Basename = string;
|
||||
export type Query = any;
|
||||
export type Action = "PUSH" | "REPLACE" | "POP";
|
||||
export interface Params {
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
export type RoutePattern = string;
|
||||
export type RouteComponent = ComponentClass<any> | StatelessComponent<any>;
|
||||
export interface RouteComponents {
|
||||
|
||||
3
react-router/lib/createMemoryHistory.d.ts
vendored
3
react-router/lib/createMemoryHistory.d.ts
vendored
@@ -1,4 +1,5 @@
|
||||
import { History, CreateHistory } from "history";
|
||||
import { History } from "history";
|
||||
import { CreateHistory } from "react-router";
|
||||
|
||||
declare const createMemoryHistory: CreateHistory<History>;
|
||||
|
||||
|
||||
5
react-router/lib/useRouterHistory.d.ts
vendored
5
react-router/lib/useRouterHistory.d.ts
vendored
@@ -1,5 +1,6 @@
|
||||
import { History, CreateHistoryEnhancer } from "history";
|
||||
import { History } from "history";
|
||||
import { CreateHistoryEnhancer } from "react-router";
|
||||
|
||||
declare const useRouterHistory: CreateHistoryEnhancer<History, any>;
|
||||
declare const useRouterHistory: CreateHistoryEnhancer<History>;
|
||||
|
||||
export default useRouterHistory;
|
||||
|
||||
Reference in New Issue
Block a user