mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 04:01:52 +00:00
react-router: Lint (#14063)
This commit is contained in:
Vendored
+3
-3
@@ -1,4 +1,4 @@
|
||||
// Type definitions for react-router v2.0.0
|
||||
// Type definitions for react-router 2.0
|
||||
// Project: https://github.com/rackt/react-router
|
||||
// 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>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -9,9 +9,9 @@ export as namespace ReactRouter;
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
export const routerShape: React.Requireable<any>
|
||||
export const routerShape: React.Requireable<any>;
|
||||
|
||||
export const locationShape: React.Requireable<any>
|
||||
export const locationShape: React.Requireable<any>;
|
||||
|
||||
import Router from "./lib/Router";
|
||||
import Link from "./lib/Link";
|
||||
|
||||
Vendored
+2
-2
@@ -12,8 +12,8 @@ declare namespace self {
|
||||
path?: Router.RoutePattern;
|
||||
component?: Router.RouteComponent;
|
||||
components?: Router.RouteComponents;
|
||||
getComponent?: (nextState: Router.RouterState, cb: (error: any, component?: Router.RouteComponent) => void) => void
|
||||
getComponents?: (nextState: Router.RouterState, cb: (error: any, components?: Router.RouteComponents) => void) => void
|
||||
getComponent?: (nextState: Router.RouterState, cb: (error: any, component?: Router.RouteComponent) => void) => void;
|
||||
getComponents?: (nextState: Router.RouterState, cb: (error: any, components?: Router.RouteComponents) => void) => void;
|
||||
onEnter?: Router.EnterHook;
|
||||
onLeave?: Router.LeaveHook;
|
||||
onChange?: Router.ChangeHook;
|
||||
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
import * as React from 'react';
|
||||
|
||||
declare const RouteContext: React.Mixin<any, any>
|
||||
declare const RouteContext: React.Mixin<any, any>;
|
||||
export default RouteContext;
|
||||
|
||||
|
||||
Vendored
+16
-16
@@ -16,7 +16,7 @@ export default Router;
|
||||
declare namespace Router {
|
||||
type RouteConfig = React.ReactNode | PlainRoute | PlainRoute[];
|
||||
type RoutePattern = string;
|
||||
type RouteComponents = { [key: string]: RouteComponent };
|
||||
interface RouteComponents { [key: string]: RouteComponent; }
|
||||
|
||||
type ParseQueryString = (queryString: QueryString) => Query;
|
||||
type StringifyQuery = (queryObject: Query) => QueryString;
|
||||
@@ -29,15 +29,15 @@ declare namespace Router {
|
||||
type ChangeHook = (prevState: RouterState, nextState: RouterState, replace: RedirectFunction, callback: Function) => void;
|
||||
type RouteHook = (nextLocation?: Location) => any;
|
||||
|
||||
type Params = { [param: string]: string };
|
||||
interface Params { [param: string]: string; }
|
||||
|
||||
type RouterListener = (error: Error, nextState: RouterState) => void;
|
||||
|
||||
type LocationDescriptor = {
|
||||
pathname?: Pathname
|
||||
query?: Query
|
||||
hash?: Href
|
||||
state?: HLocationState
|
||||
interface LocationDescriptor {
|
||||
pathname?: Pathname;
|
||||
query?: Query;
|
||||
hash?: Href;
|
||||
state?: HLocationState;
|
||||
}
|
||||
|
||||
interface RedirectFunction {
|
||||
@@ -103,14 +103,14 @@ declare namespace Router {
|
||||
// https://github.com/reactjs/react-router/blob/v2.4.0/upgrade-guides/v2.4.0.md
|
||||
|
||||
interface InjectedRouter {
|
||||
push: (pathOrLoc: Path | LocationDescriptor) => void
|
||||
replace: (pathOrLoc: Path | LocationDescriptor) => void
|
||||
go: (n: number) => void
|
||||
goBack: () => void
|
||||
goForward: () => void
|
||||
setRouteLeaveHook(route: PlainRoute, callback: RouteHook): void
|
||||
createPath(path: History.Path, query?: History.Query): History.Path
|
||||
createHref(path: History.Path, query?: History.Query): History.Href
|
||||
isActive: (pathOrLoc: Path | LocationDescriptor, indexOnly?: boolean) => boolean
|
||||
push: (pathOrLoc: Path | LocationDescriptor) => void;
|
||||
replace: (pathOrLoc: Path | LocationDescriptor) => void;
|
||||
go: (n: number) => void;
|
||||
goBack: () => void;
|
||||
goForward: () => void;
|
||||
setRouteLeaveHook(route: PlainRoute, callback: RouteHook): void;
|
||||
createPath(path: History.Path, query?: History.Query): History.Path;
|
||||
createHref(path: History.Path, query?: History.Query): History.Href;
|
||||
isActive: (pathOrLoc: Path | LocationDescriptor, indexOnly?: boolean) => boolean;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+5
-5
@@ -4,11 +4,11 @@ import * as H from 'history';
|
||||
export default History;
|
||||
|
||||
export interface HistoryRoutes {
|
||||
listen(listener: Router.RouterListener): Function
|
||||
listenBeforeLeavingRoute(route: Router.PlainRoute, hook: Router.RouteHook): void
|
||||
match(location: H.Location, callback: (error: any, nextState: Router.RouterState, nextLocation: H.Location) => void): void
|
||||
isActive(pathname: H.Pathname, query?: H.Query, indexOnly?: boolean): boolean
|
||||
setRouteLeaveHook(route: Router.PlainRoute, callback: Router.RouteHook): void
|
||||
listen(listener: Router.RouterListener): Function;
|
||||
listenBeforeLeavingRoute(route: Router.PlainRoute, hook: Router.RouteHook): void;
|
||||
match(location: H.Location, callback: (error: any, nextState: Router.RouterState, nextLocation: H.Location) => void): void;
|
||||
isActive(pathname: H.Pathname, query?: H.Query, indexOnly?: boolean): boolean;
|
||||
setRouteLeaveHook(route: Router.PlainRoute, callback: Router.RouteHook): void;
|
||||
}
|
||||
|
||||
export interface HistoryBase extends H.History {
|
||||
|
||||
+1
-5
@@ -1,7 +1,3 @@
|
||||
import { History, HistoryOptions, HistoryQueries, CreateHistory } from 'history';
|
||||
|
||||
interface CreateRouterHistory {
|
||||
(options?: HistoryOptions): History & HistoryQueries;
|
||||
}
|
||||
|
||||
export default function useRouterHistory<T>(createHistory: CreateHistory<T>): CreateRouterHistory;
|
||||
export default function useRouterHistory<T>(createHistory: CreateHistory<T>): (options?: HistoryOptions) => History & HistoryQueries;
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
import * as React from 'react';
|
||||
|
||||
declare function withRouter<C extends React.ComponentClass<any> | React.StatelessComponent<any> | React.PureComponent<any, any>>(component: C): C
|
||||
declare function withRouter<C extends React.ComponentClass<any> | React.StatelessComponent<any> | React.PureComponent<any, any>>(component: C): C;
|
||||
export default withRouter;
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "../tslint.json",
|
||||
"rules": {
|
||||
"forbidden-types": false,
|
||||
"no-empty-interface": false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user