Params and Payload now have index signatures. Added Query interface. (#35500)

* Params and Payload should have index signatures

* Converted type to interface

* Created Query interface for query parameter object

* added harry hedger to contributors
This commit is contained in:
Harry Hedger 2019-05-22 09:11:26 -07:00 committed by Ryan Cavanaugh
parent b1ca386416
commit 083ba71eab
2 changed files with 21 additions and 10 deletions

View File

@ -7,6 +7,7 @@
// jscinoz <https://github.com/jscinoz>
// surgeboris <https://github.com/surgeboris>
// geirsagberg <https://github.com/geirsagberg>
// Harry Hedger <https://github.com/hedgerh>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
@ -54,7 +55,7 @@ export interface ReceivedAction {
type: string;
payload: Payload;
meta?: object;
query?: object;
query?: Query;
search?: string;
navKey?: Nullable<string>;
}
@ -62,11 +63,11 @@ export interface ReceivedAction {
export interface ReceivedActionMeta {
type: string;
payload: Payload;
query?: object;
query?: Query;
navKey?: Nullable<string>;
meta: {
notFoundPath?: string;
query?: object;
query?: Query;
search?: string;
};
}
@ -83,7 +84,7 @@ export interface Location {
pathname: string;
type: string;
payload: Payload;
query?: object;
query?: Query;
search?: string;
}
@ -91,7 +92,7 @@ export interface LocationState<TKeys = {}, TState = any> {
pathname: string;
type: string;
payload: Payload;
query?: object;
query?: Query;
search?: string;
prev: Location;
kind: Nullable<string>;
@ -122,7 +123,7 @@ export interface Meta {
location: ActionMetaLocation;
notFoundPath?: string;
navigation?: NavigationAction;
query?: object;
query?: Query;
search?: string;
}
@ -130,7 +131,7 @@ export interface Action {
type: string;
payload?: Payload;
meta?: Meta;
query?: object;
query?: Query;
navKey?: Nullable<string>;
}
@ -296,8 +297,18 @@ export interface Options<TKeys = {}, TState = any> {
extra?: any;
}
export type Params = object;
export type Payload = object;
export interface Query {
[key: string]: string;
}
export interface Params {
[key: string]: any;
}
export interface Payload {
query?: Query;
[key: string]: any;
}
export type DisplayConfirmLeave = (message: string, callback: (unblock: boolean) => void) => void;

View File

@ -70,7 +70,7 @@ const { reducer, middleware, enhancer, initialDispatch, thunk } = connectRoutes(
initialEntries: [],
querySerializer: {
stringify: queryString => {
queryString; // $ExpectType object
queryString; // $ExpectType Params
return '';
},
parse: params => {