Skip to content

Commit 8bed928

Browse files
fix: type error after upgrade typescript@5.1
1 parent eb9e26b commit 8bed928

27 files changed

+285
-123
lines changed

dist/filterdata.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/filterdata.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/lib/filterData.d.ts

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { FilterDataOption, SearchConditionMultiple } from './lib/types';
2+
/**
3+
*
4+
* @param {*array} allData: Array of object
5+
* @param {*array} searchConditions
6+
* @param {*object} optionsIn: { caseSensitive: false, includeNull: false, offset: undefined, limit: undefined }
7+
*/
8+
declare function filterData<T>(allData: ReadonlyArray<T>, searchConditions: SearchConditionMultiple[], optionsIn?: FilterDataOption): T[];
9+
export default filterData;

dist/lib/filters/equal.d.ts

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import type { FilterFunction } from '../lib/types';
2+
/**
3+
* equal check for data
4+
*
5+
* @param {*object} searchCondition: { name, value }
6+
* @param {*boolean} caseSensitive: false
7+
* @param {*DataObject} data
8+
*/
9+
declare const equal: FilterFunction;
10+
export default equal;

dist/lib/filters/filtersMap.d.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import SearchType from '../lib/SearchType';
2+
import type { FilterFunction } from '../lib/types';
3+
declare const filtersMap: Record<SearchType, FilterFunction>;
4+
export default filtersMap;

dist/lib/filters/greater.d.ts

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import type { FilterFunction } from '../lib/types';
2+
/**
3+
* greater check for data
4+
*
5+
* @param {*object} searchCondition: { name, value }
6+
* @param {*boolean} caseSensitive: false
7+
* @param {*DataObject} data
8+
*/
9+
declare const greater: FilterFunction;
10+
export default greater;

dist/lib/filters/greaterOrEqual.d.ts

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* greater or equal check for data
3+
*
4+
* @param {*object} searchCondition: { name, value }
5+
* @param {*boolean} caseSensitive: false
6+
* @param {*DataObject} data
7+
*/
8+
declare const greaterOrEqual: import("ts-toolbelt/out/Function/Curry").Curry<(searchCondition: import("../lib/types").SearchCondition, caseSensitive: boolean, data: import("../lib/types").DataObject) => boolean>;
9+
export default greaterOrEqual;

dist/lib/filters/index.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from './filtersMap';

dist/lib/filters/less.d.ts

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* less check for data
3+
*
4+
* @param {*object} searchCondition: { name, value }
5+
* @param {*boolean} caseSensitive: false
6+
* @param {*DataObject} data
7+
*/
8+
declare const less: import("ts-toolbelt/out/Function/Curry").Curry<(searchCondition: import("../lib/types").SearchCondition, caseSensitive: boolean, data: import("../lib/types").DataObject) => boolean>;
9+
export default less;

dist/lib/filters/lessOrEqual.d.ts

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* less or equal check for data
3+
*
4+
* @param {*object} searchCondition: { name, value }
5+
* @param {*boolean} caseSensitive: false
6+
* @param {*DataObject} data
7+
*/
8+
declare const lessOrEqual: import("ts-toolbelt/out/Function/Curry").Curry<(searchCondition: import("../lib/types").SearchCondition, caseSensitive: boolean, data: import("../lib/types").DataObject) => boolean>;
9+
export default lessOrEqual;

dist/lib/filters/like.d.ts

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import type { SearchCondition, DataObject } from '../lib/types';
2+
/**
3+
* like check for data
4+
*
5+
* @param {*object} searchCondition: { name, value }
6+
* @param {*boolean} caseSensitive: false
7+
* @param {*DataObject} data
8+
*/
9+
declare const like: (searchCondition: SearchCondition, caseSensitive: boolean, data: DataObject) => boolean;
10+
export default like;

dist/lib/filters/notEqual.d.ts

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* not equal check for data
3+
*
4+
* @param {*object} searchCondition: { name, value }
5+
* @param {*boolean} caseSensitive: false
6+
* @param {*DataObject} data
7+
*/
8+
declare const notEqual: (conditions: import("../lib/types").SearchCondition, caseSensitive: boolean, data: import("../lib/types").DataObject) => boolean;
9+
export default notEqual;

dist/lib/filters/notLike.d.ts

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* not like check for data
3+
*
4+
* @param {*object} searchCondition: { name, value }
5+
* @param {*boolean} caseSensitive: false
6+
* @param {*DataObject} data
7+
*/
8+
declare const notLike: import("ts-toolbelt/out/Function/Curry").Curry<(searchCondition: import("../lib/types").SearchCondition, caseSensitive: boolean, data: import("../lib/types").DataObject) => boolean>;
9+
export default notLike;

dist/lib/index.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { default as SearchType } from './lib/SearchType';
2+
export { default as filterData } from './filterData';

dist/lib/lib/SearchType.d.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
declare enum SearchType {
2+
EQ = "equal",
3+
GT = "greater",
4+
GTE = "greaterorequal",
5+
LT = "less",
6+
LTE = "lessorequal",
7+
LK = "like",
8+
NE = "notequal",
9+
NLK = "notlike"
10+
}
11+
export default SearchType;

dist/lib/lib/types.d.ts

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import type SearchType from './SearchType';
2+
export interface FilterDataOption {
3+
caseSensitive?: boolean;
4+
includeNull?: boolean;
5+
offset?: number;
6+
limit?: number;
7+
}
8+
export interface SearchCondition {
9+
key: string | string[];
10+
value: string | number;
11+
type: SearchType;
12+
}
13+
export interface SearchConditionMultiple {
14+
key: string | string[] | string[][];
15+
value?: string | number;
16+
type: SearchType;
17+
}
18+
export type DataObjectValues = string | number | (string | number)[];
19+
export interface DataObject {
20+
[key: string]: DataObjectValues | DataObject;
21+
}
22+
export type DataObjectWithNullValues = DataObjectValues | null;
23+
export interface DataObjectWithNull {
24+
[key: string]: DataObjectWithNullValues | DataObjectWithNull;
25+
}
26+
export type Predicator = (data: DataObject) => boolean;
27+
export type FilterFunction = (conditions: SearchCondition, caseSensitive: boolean, data: DataObject) => boolean;

dist/lib/lib/utils.d.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { transduce, filter, curry, complement, allPass, anyPass, drop, take } from 'ramda';
2+
import type { DataObjectValues, DataObjectWithNull } from './types';
3+
type AnyFunction = (...args: any[]) => any;
4+
declare function listCombiner(list: any[], val: any): any[];
5+
declare function compose(...fns: AnyFunction[]): (...args: any[]) => any[];
6+
declare function getObjValue(data: DataObjectWithNull, key: string | string[]): DataObjectValues | undefined;
7+
export { listCombiner, compose, transduce, filter, curry, complement, allPass, anyPass, drop, take, getObjValue, };
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import type { F } from 'ts-toolbelt';
2+
import type { SearchCondition, DataObject } from '../lib/types';
3+
type PredicatorWithOptions = (searchCondition: SearchCondition, caseSensitive: boolean, data: DataObject) => boolean;
4+
/**
5+
* exclude data if targetValue is an array
6+
*
7+
* @param {*function} filterCallback
8+
* @param {*object} searchCondition: { name, value }
9+
* @param {*boolean} caseSensitive: false
10+
* @param {*DataObject} data
11+
*/
12+
declare const excludeIfTargetValueIsArray: (predicator: PredicatorWithOptions, searchCondition: SearchCondition, caseSensitive: boolean, data: DataObject) => boolean;
13+
declare const targetValueArray: F.Curry<typeof excludeIfTargetValueIsArray>;
14+
export default targetValueArray;
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import type { DataObjectWithNull, Predicator, SearchCondition } from '../lib/types';
2+
declare const _default: import("ts-toolbelt/out/Function/Curry").Curry<(includeNull: boolean, { key }: SearchCondition, predicator: Predicator, data: DataObjectWithNull) => boolean>;
3+
export default _default;

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,15 @@
6363
"@types/ramda": "^0.29.2",
6464
"@web-configs/eslint-plugin": "^0.5.1",
6565
"@web-configs/prettier": "^0.1.2",
66-
"eslint": "^8.41.0",
66+
"eslint": "^8.42.0",
6767
"fuse.js": "^6.6.2",
6868
"jest": "^29.2.2",
6969
"match-sorter": "^6.3.1",
7070
"prettier": "^2.8.8",
7171
"rimraf": "^5.0.1",
7272
"rollup": "^2.79.1",
7373
"rollup-plugin-terser": "^7.0.2",
74+
"ts-toolbelt": "^9.6.0",
7475
"tslib": "^2.5.3",
7576
"tsx": "^3.12.7",
7677
"typescript": "^5.1.3"

0 commit comments

Comments
 (0)