Skip to content
This repository has been archived by the owner on Dec 15, 2018. It is now read-only.

Commit

Permalink
Use object literal type instead of any
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoLegends authored and tptee committed Mar 28, 2018
1 parent d4b5fa4 commit baef892
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@
import * as React from "react";
import { Action, Reducer, Middleware, StoreEnhancer } from "redux";

export type Query = { [key: string]: string };
export type Params = { [key: string]: string };
export type ObjectLiteral<T> = { [key: string]: T };

export type Query = ObjectLiteral<string>;
export type Params = ObjectLiteral<string>;

/* check out https://basarat.gitbooks.io/typescript/docs/types/index-signatures.html to read more
about what is happening here. */
export interface Routes {
[key: string]: {
[key: string]: any;
};
}
export type Routes = ObjectLiteral<ObjectLiteral<any>>;

export type LocationOptions = {
persistQuery?: boolean;
Expand All @@ -28,7 +26,7 @@ export interface HistoryLocation {
key?: string
pathname: string,
search?: string,
state?: any,
state?: ObjectLiteral<any>,
}

export interface Location extends HistoryLocation {
Expand All @@ -38,7 +36,7 @@ export interface Location extends HistoryLocation {
previous?: Location;
query?: Query;
queue?: Array<Location>;
result?: any;
result?: ObjectLiteral<any>;
routes?: Routes;
}

Expand Down Expand Up @@ -130,9 +128,9 @@ export interface History {
location: Location;
action: Action;
listen(callback: ListenCallback): Unsubscribe;
push(path: string, state?: any): void;
push(path: string, state?: ObjectLiteral<any>): void;
push(location: Location): void;
replace(path: string, state?: any): void;
replace(path: string, state?: ObjectLiteral<any>): void;
replace(location: Location): void;
go(n: number): void;
goBack(): void;
Expand Down Expand Up @@ -200,7 +198,7 @@ export interface LinkProps {
replaceState?: boolean;
target?: string;
onClick?: (event: Event) => any;
style?: any;
style?: ObjectLiteral<any>;
location?: Location;
push?: (href: Href, options: LocationOptions) => {
type: string;
Expand All @@ -210,7 +208,7 @@ export interface LinkProps {
type: string;
payload: Location;
};
activeProps?: any;
activeProps?: ObjectLiteral<any>;
}

export declare class Link extends React.Component<LinkProps, {}> {}
Expand All @@ -228,7 +226,7 @@ export interface FragmentProps {
withConditions?: (location: Location) => boolean;
forNoMatch?: boolean;
parentId?: string;
style?: any;
style?: ObjectLiteral<any>;
}

export declare class Fragment extends React.Component<FragmentProps, {}> {}
Expand Down

0 comments on commit baef892

Please sign in to comment.