Skip to content

Commit

Permalink
fix: changed type definition of queryParams to be more accurate
Browse files Browse the repository at this point in the history
  • Loading branch information
nareshbhatia committed Jun 21, 2019
1 parent 8dbf0b8 commit d6a723c
Show file tree
Hide file tree
Showing 4 changed files with 1,520 additions and 1,460 deletions.
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@
"peerDependencies": {
"history": "^4.x",
"mobx": "^4.x || ^5.x",
"mobx-react": "^5.x",
"mobx-react": "^5.x || ^6.x",
"react": "^16.x"
},
"devDependencies": {
"@commitlint/cli": "^7.5.2",
"@commitlint/config-conventional": "^7.5.0",
"@commitlint/cli": "^8.0.0",
"@commitlint/config-conventional": "^8.0.0",
"@types/enzyme": "^3.9.1",
"@types/history": "^4.7.2",
"@types/jest": "^24.0.11",
"@types/node": "^11.12.2",
"@types/node": "^12.0.8",
"@types/query-string": "^5.1.0",
"@types/react": "^16.8.10",
"@types/react-dom": "^16.8.3",
Expand All @@ -60,16 +60,15 @@
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.11.2",
"history": "^4.9.0",
"husky": "^1.3.1",
"husky": "^2.4.1",
"jest": "^24.5.0",
"mobx": "^5.9.4",
"mobx-react": "^5.4.3",
"mobx-react": "^5.4.4",
"prettier": "^1.16.4",
"pretty-quick": "^1.10.0",
"prompt": "^1.0.0",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"replace-in-file": "^3.4.4",
"rimraf": "^2.6.3",
"semantic-release": "^15.13.3",
"ts-jest": "^24.0.1",
Expand Down
2 changes: 1 addition & 1 deletion src/components/router-link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface RouterLinkProps
rootStore?: any;
routeName: string;
params?: StringMap;
queryParams?: Object;
queryParams?: { [key: string]: any };
className?: string;
activeClassName?: string;
}
Expand Down
12 changes: 6 additions & 6 deletions src/router-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { action, observable } from 'mobx';
* }
*/
export interface StringMap {
[param: string]: string;
[key: string]: string;
}

/**
Expand All @@ -21,7 +21,7 @@ export interface StringMap {
export interface JsRouterState {
routeName: string;
params?: StringMap;
queryParams?: Object;
queryParams?: { [key: string]: any };
}

/**
Expand All @@ -34,12 +34,12 @@ export class RouterState {
* Creates RouterState
* @param {string} routeName, e.g. 'department'
* @param {StringMap} params, e.g. { id: 'electronics' }
* @param {Object} queryParams, e.g. { q: 'apple' } or { items: ['E1', 'E2'] }
* @param {[key: string]: any} queryParams, e.g. { q: 'apple' } or { items: ['E1', 'E2'] }
*/
constructor(
readonly routeName: string,
readonly params: StringMap = {},
readonly queryParams: Object = {}
readonly queryParams: { [key: string]: any } = {}
) {}

static create(jsRouterState: JsRouterState): RouterState {
Expand Down Expand Up @@ -140,12 +140,12 @@ export class RouterStore {
goTo(
routeName: string,
params?: StringMap,
queryParams?: Object
queryParams?: { [key: string]: any }
): Promise<RouterState>;
goTo(
toStateOrRouteName: RouterState | string,
params: StringMap = {},
queryParams: Object = {}
queryParams: { [key: string]: any } = {}
): Promise<RouterState> {
const toState =
typeof toStateOrRouteName === 'string'
Expand Down
Loading

0 comments on commit d6a723c

Please sign in to comment.