From baef892b0b672ad15cc9c00f62b8843784a667c0 Mon Sep 17 00:00:00 2001 From: Moritz Gunz Date: Mon, 26 Mar 2018 20:50:25 +0200 Subject: [PATCH] Use object literal type instead of any --- index.d.ts | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/index.d.ts b/index.d.ts index 598c5c87..7b53a0ff 100644 --- a/index.d.ts +++ b/index.d.ts @@ -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 = { [key: string]: T }; + +export type Query = ObjectLiteral; +export type Params = ObjectLiteral; /* 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>; export type LocationOptions = { persistQuery?: boolean; @@ -28,7 +26,7 @@ export interface HistoryLocation { key?: string pathname: string, search?: string, - state?: any, + state?: ObjectLiteral, } export interface Location extends HistoryLocation { @@ -38,7 +36,7 @@ export interface Location extends HistoryLocation { previous?: Location; query?: Query; queue?: Array; - result?: any; + result?: ObjectLiteral; routes?: Routes; } @@ -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): void; push(location: Location): void; - replace(path: string, state?: any): void; + replace(path: string, state?: ObjectLiteral): void; replace(location: Location): void; go(n: number): void; goBack(): void; @@ -200,7 +198,7 @@ export interface LinkProps { replaceState?: boolean; target?: string; onClick?: (event: Event) => any; - style?: any; + style?: ObjectLiteral; location?: Location; push?: (href: Href, options: LocationOptions) => { type: string; @@ -210,7 +208,7 @@ export interface LinkProps { type: string; payload: Location; }; - activeProps?: any; + activeProps?: ObjectLiteral; } export declare class Link extends React.Component {} @@ -228,7 +226,7 @@ export interface FragmentProps { withConditions?: (location: Location) => boolean; forNoMatch?: boolean; parentId?: string; - style?: any; + style?: ObjectLiteral; } export declare class Fragment extends React.Component {}