Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

[chore] ts fixes (#2147)

Igor Dykhta425a60116f82
diff --git a/src/actions/src/vis-state-actions.ts b/src/actions/src/vis-state-actions.ts
index 2cdd3567a..2f9998408 100644
--- a/src/actions/src/vis-state-actions.ts
+++ b/src/actions/src/vis-state-actions.ts
@@ -364,7 +364,7 @@ export function setFilterAnimationWindow({
}
export type AddFilterUpdaterAction = {
- dataId?: string | null;
+ dataId?: string | string[] | null;
};
/**
* Add a new filter
diff --git a/src/types/reducers.d.ts b/src/types/reducers.d.ts
index 5bf56b32a..1587fbf62 100644
--- a/src/types/reducers.d.ts
+++ b/src/types/reducers.d.ts
@@ -119,10 +119,11 @@ export type SelectFilter = FilterBase<LineChart> &
export type MultiSelectFilter = FilterBase<LineChart> &
MultiSelectFieldDomain & {
- type: 'range';
+ type: 'multiSelect';
fieldType: 'string' | 'date';
value: string[];
};
+
export type TimeRangeFilter = FilterBase<LineChart> &
TimeRangeFieldDomain & {
type: 'timeRange';
@@ -446,3 +447,55 @@ export type FilterDatasetOpt = {
// ignore filter for domain calculation
ignoreDomain?: boolean;
};
+
+/* DUPLICATES OF FILTER TYPES ABOVE, REMOVE ONCE TYPES ABOVE ARE FIXED */
+
+export type TypedRangeFilter = FilterBase<LineChart> &
+ RangeFieldDomain & {
+ type: 'range';
+ fieldType: 'real' | 'integer';
+ value: [number, number];
+ fixedDomain: true;
+ typeOptions: ['range'];
+ };
+
+export type TypedSelectFilter = FilterBase<LineChart> &
+ SelectFieldDomain & {
+ type: 'select';
+ fieldType: 'boolean';
+ value: boolean;
+ };
+
+export type TypedMultiSelectFilter = FilterBase<LineChart> &
+ MultiSelectFieldDomain & {
+ type: 'multiSelect';
+ fieldType: 'string' | 'date';
+ value: string[];
+ };
+
+export type TypedTimeRangeFilter = FilterBase<LineChart> &
+ TimeRangeFieldDomain & {
+ type: 'timeRange';
+ fieldType: 'timestamp';
+ fixedDomain: true;
+ value: [number, number];
+ bins?: Object;
+ plotType: {
+ [key: string]: any;
+ };
+ animationWindow: string;
+ };
+
+export type TypedPolygonFilter = FilterBase<LineChart> & {
+ layerId: string[];
+ type: 'polygon';
+ fixedDomain: true;
+ value: Feature;
+};
+
+export type TypedFilter =
+ | TypedRangeFilter
+ | TypedTimeRangeFilter
+ | TypedSelectFilter
+ | TypedMultiSelectFilter
+ | TypedPolygonFilter;