Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[chore] Fix TypeScript Errors (#3076)
Indranil Halderafc21c263170
diff --git a/src/deckgl-arrow-layers/src/types.ts b/src/deckgl-arrow-layers/src/types.tsindex d6e0bf606..567c958e6 100644--- a/src/deckgl-arrow-layers/src/types.ts+++ b/src/deckgl-arrow-layers/src/types.ts@@ -73,6 +73,6 @@ export type NormalAccessor =| Accessor<arrow.Table, arrow.Vector<arrow.FixedSizeList<arrow.Float32>>>;export type ExtensionProps = {- getFiltered?: ({index: number}) => number;+ getFiltered?: ({index}: {index: number}) => number;getFilterValue?: (d: any, objectInfo?: {index: number}) => (number | number[])[];};diff --git a/src/layers/src/aggregation-layer.ts b/src/layers/src/aggregation-layer.tsindex c9e62e7bd..d8b757a3c 100644--- a/src/layers/src/aggregation-layer.ts+++ b/src/layers/src/aggregation-layer.ts@@ -53,7 +53,9 @@ export const getFilterDataFunc =getFilterValue: (d: unknown) => (number | number[])[]): ((d: unknown) => boolean) =>pt =>- getFilterValue(pt).every((val, i) => val >= filterRange[i][0] && val <= filterRange[i][1]);+ getFilterValue(pt).every((val, i) => {+ return typeof val === 'number' ? val >= filterRange[i][0] && val <= filterRange[i][1] : false;+ });const getLayerColorRange = (colorRange: ColorRange) => colorRange.colors.map(hexToRgb);diff --git a/src/processors/src/data-processor.ts b/src/processors/src/data-processor.tsindex 65a6c900e..51ac495b3 100644--- a/src/processors/src/data-processor.ts+++ b/src/processors/src/data-processor.ts@@ -262,8 +262,9 @@ export function processRowObject(rawData: unknown[]): ProcessorResult {};}- const keys = Object.keys(rawData[0]); // [lat, lng, value]- const rows = rawData.map(d => keys.map(key => d[key])); // [[31.27, 127.56, 3]]+ const firstRow = rawData[0] as Record<string, unknown>;+ const keys = Object.keys(firstRow); // [lat, lng, value]+ const rows = rawData.map(d => keys.map(key => (d as Record<string, unknown>)[key])); // [[31.27, 127.56, 3]]// row object can still contain values like `Null` or `N/A`cleanUpFalsyCsvValue(rows);diff --git a/src/reducers/src/map-style.ts b/src/reducers/src/map-style.tsindex 395e91f2f..d955e7af1 100644--- a/src/reducers/src/map-style.ts+++ b/src/reducers/src/map-style.ts@@ -24,8 +24,7 @@ const actionHandler = {[ActionTypes.REMOVE_CUSTOM_MAP_STYLE]: mapStyleUpdaters.removeCustomMapStyleUpdater,[ActionTypes.RESET_MAP_CONFIG]: mapStyleUpdaters.resetMapConfigMapStyleUpdater,[ActionTypes.SET_3D_BUILDING_COLOR]: mapStyleUpdaters.set3dBuildingColorUpdater,- [ActionTypes.SET_BACKGROUND_COLOR]: mapStyleUpdaters.setBackgroundColorUpdater,- [ActionTypes.RESET_MAP_CONFIG]: mapStyleUpdaters.resetMapConfigMapStyleUpdater+ [ActionTypes.SET_BACKGROUND_COLOR]: mapStyleUpdaters.setBackgroundColorUpdater};export const mapStyleReducerFactory = (initialState = {}) =>diff --git a/src/table/src/tileset/vector-tile-utils.ts b/src/table/src/tileset/vector-tile-utils.tsindex 3716d0947..e7487d7aa 100644--- a/src/table/src/tileset/vector-tile-utils.ts+++ b/src/table/src/tileset/vector-tile-utils.ts@@ -489,9 +489,9 @@ function compare(num1: number | undefined, num2: number | undefined, operator: sreturn Number.isFinite(num1) && Number.isFinite(num2)? Math[operator](num1 as number, num2 as number): Number.isFinite(num1)- ? num1+ ? (num1 as number): Number.isFinite(num2)- ? num2+ ? (num2 as number): NaN;}diff --git a/src/utils/src/data-container-interface.ts b/src/utils/src/data-container-interface.tsindex 37e669d1d..f785eb350 100644--- a/src/utils/src/data-container-interface.ts+++ b/src/utils/src/data-container-interface.ts@@ -129,7 +129,7 @@ export interface DataContainerInterface {* @returns A new array with each element being the result of the func callback.*/mapIndex(- func: ({index: number}, dataContainer: DataContainerInterface) => any,+ func: ({index}: {index: number}, dataContainer: DataContainerInterface) => any,options?: RangeOptions): any[];diff --git a/src/utils/src/row-data-container.ts b/src/utils/src/row-data-container.tsindex 50222a317..6083df9b1 100644--- a/src/utils/src/row-data-container.ts+++ b/src/utils/src/row-data-container.ts@@ -117,7 +117,7 @@ export class RowDataContainer implements DataContainerInterface {}mapIndex<T>(- func: ({index: number}, dc: DataContainerInterface) => T,+ func: ({index}: {index: number}, dc: DataContainerInterface) => T,options: RangeOptions = {}): T[] {const {start = 0, end = this.numRows()} = options;