Skip to content

Commit 5609fda

Browse files
refactor: separate file for reuseable types
1 parent 47620cf commit 5609fda

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/lib/base-query.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { AxiosInstance, getData } from '@contentstack/core';
22
import { Pagination } from './pagination';
33
import { FindResponse } from './types';
4+
import { params } from './internal-types';
45

56
export class BaseQuery extends Pagination {
6-
_parameters: { [key: string]: any } = {}; // Params of query class ?query={}
7+
_parameters: params = {}; // Params of query class ?query={}
8+
79
protected _client!: AxiosInstance;
810
protected _urlPath!: string;
911

src/lib/internal-types.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export type params = {
2+
[key: string]: any
3+
}
4+
5+
export type queryParams = {
6+
[key: string]: string | boolean | number
7+
}

src/lib/pagination.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { PaginationObj } from './types';
2+
import { queryParams } from './internal-types';
23

34
export class Pagination {
4-
_queryParams: { [key: string]: string | boolean | number } = {};
5+
_queryParams: queryParams = {};
56
/**
67
* @method constructor
78
* @memberof Pagination

0 commit comments

Comments
 (0)