Skip to content

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

Typings for some lodash packages added (#1817)

dariaterekhovaae2d557df33a43
diff --git a/package.json b/package.json
index 08e810573..7fb0714cb 100644
--- a/package.json
+++ b/package.json
@@ -80,7 +80,7 @@
"umd"
],
"dependencies": {
- "@danmarshall/deckgl-typings": "^4.9.21",
+ "@danmarshall/deckgl-typings": "4.9.22",
"@deck.gl/aggregation-layers": "8.2.0",
"@deck.gl/core": "8.2.0",
"@deck.gl/extensions": "8.2.0",
@@ -109,9 +109,15 @@
"@types/d3-selection": "^3.0.2",
"@types/exenv": "^1.2.0",
"@types/keymirror": "^0.1.1",
+ "@types/lodash.clonedeep": "^4.5.7",
+ "@types/lodash.curry": "^4.1.7",
+ "@types/lodash.flattendeep": "^4.4.7",
"@types/lodash.get": "^4.4.6",
"@types/lodash.isequal": "^4.5.5",
"@types/lodash.pick": "^4.4.6",
+ "@types/lodash.uniq": "^4.5.7",
+ "@types/lodash.uniqby": "^4.7.7",
+ "@types/lodash.xor": "^4.5.7",
"@types/mapbox__geo-viewport": "^0.4.1",
"@types/react-lifecycles-compat": "^3.0.1",
"@types/react-map-gl": "^6.1.2",
diff --git a/src/deckgl-layers/3d-building-layer/3d-building-layer.ts b/src/deckgl-layers/3d-building-layer/3d-building-layer.ts
index e3ed0d571..d27bd906c 100644
--- a/src/deckgl-layers/3d-building-layer/3d-building-layer.ts
+++ b/src/deckgl-layers/3d-building-layer/3d-building-layer.ts
@@ -24,13 +24,13 @@ import {getTileData} from './3d-building-utils';
import {ThreeDBuildingLayerProps, Coordinates, TileDataItem} from './types';
import {SolidPolygonLayer} from '@deck.gl/layers';
-export default class ThreeDBuildingLayer extends CompositeLayer<ThreeDBuildingLayerProps> {
+export default class ThreeDBuildingLayer extends CompositeLayer<{}, ThreeDBuildingLayerProps> {
// this layer add its subLayers to the redux store, and push sample data
renderSubLayers(props: ThreeDBuildingLayerProps) {
- return new SolidPolygonLayer({
+ return new SolidPolygonLayer<TileDataItem>({
...props,
- parameter: {
+ parameters: {
blendFunc: ['SRC_ALPHA', 'ONE_MINUS_SRC_ALPHA', 'ONE', 'ONE_MINUS_SRC_ALPHA'],
blendEquation: ['FUNC_ADD', 'FUNC_ADD']
},
diff --git a/src/deckgl-layers/3d-building-layer/3d-building-utils.ts b/src/deckgl-layers/3d-building-layer/3d-building-utils.ts
index 1a4e05003..0b9cc3d28 100644
--- a/src/deckgl-layers/3d-building-layer/3d-building-utils.ts
+++ b/src/deckgl-layers/3d-building-layer/3d-building-utils.ts
@@ -151,7 +151,7 @@ function getCoordinates(vectorTileFeature: VectorTileFeature): FlatFigure[] {
} else if (cmd === 7) {
// Workaround for https://github.com/mapbox/mapnik-vector-tile/issues/90
if (line) {
- line.push(line[0].slice()); // closePolygon
+ line.push(line[0].slice() as ([number, number] | [number, number, number])); // closePolygon
}
} else {
throw new Error(`unknown command ${cmd}`);
diff --git a/src/deckgl-layers/3d-building-layer/types.ts b/src/deckgl-layers/3d-building-layer/types.ts
index 6292436d0..980b6daf5 100644
--- a/src/deckgl-layers/3d-building-layer/types.ts
+++ b/src/deckgl-layers/3d-building-layer/types.ts
@@ -11,7 +11,7 @@ export type ThreeDBuildingLayerProps = {
};
export type Coordinates = {x: number; y: number; z: number};
// TODO rename
-export type FlatFigure = number[][];
+export type FlatFigure = ([number, number] | [number, number, number])[];
export type TileDataItem = {coordinates: FlatFigure[]; properties: VectorTileFeatureProperties};
export type VectorTileFeatureProperties = {layer: string; height?: number};
export type VectorTileFeature = {
diff --git a/src/typedefs/README.md b/src/typedefs/README.md
deleted file mode 100644
index 2144f7928..000000000
--- a/src/typedefs/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-## typedefs
-
-This directory holds stubbed Typescript definitions for untyped modules we depend on. These only cover module exports used in Kepler.gl, and are insufficient for general use; ideally we can replace them in the future with proper definitions as those modules provide more types.
\ No newline at end of file
diff --git a/src/typedefs/deck.gl__core.d.ts b/src/typedefs/deck.gl__core.d.ts
deleted file mode 100644
index 075c8ae78..000000000
--- a/src/typedefs/deck.gl__core.d.ts
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (c) 2020 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-/**
- * Stubbed Typescript types for certain classes in @deck.gl/core
- * TODO: This is initially focused on fixing things for our own usage;
- * we should eventually package proper types with the module.
- */
-declare module '@deck.gl/core' {
- export class Layer {
- constructor(any): Layer;
- id: string;
- state: any;
- props: any;
- context: any;
- draw(any): void;
- setState(any): void;
- setNeedsUpdate(): void;
- setNeedsRedraw(): void;
- getShaders(any?): any;
- getAttributeManager(): any;
- use64bitPositions(): boolean;
- finalizeState(): void;
- }
-
- export class CompositeLayer extends Layer {
- getSubLayerAccessor(any): any;
- getSubLayerProps(any): any;
- getSubLayerRow(any, any, number): any;
- }
-
- export class SimpleMeshLayer extends Layer {}
-
- export const log = any;
- export const project32: any;
- export const picking: any;
-
- export const FlyToInterpolator: any;
- export const _GlobeView: any;
- export const MapView: any;
-
- interface ConstantMap {
- [key: string]: string;
- }
-
- export const COORDINATE_SYSTEM: ConstantMap;
-}
diff --git a/src/typedefs/deck.gl__mesh-layers.d.ts b/src/typedefs/deck.gl__mesh-layers.d.ts
deleted file mode 100644
index 451f61046..000000000
--- a/src/typedefs/deck.gl__mesh-layers.d.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (c) 2020 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-/**
- * Very rough Typescript types for certain classes in @deck.gl/mesh-layers
- * TODO: This is initially focused on fixing things for our own usage;
- * we should eventually package proper types with the module.
- */
-
-declare module '@deck.gl/mesh-layers' {
- import {Layer} from '@deck.gl/core';
-
- export class SimpleMeshLayer extends Layer {
- constructor(any): SimpleMeshLayer;
- }
-}
diff --git a/yarn.lock b/yarn.lock
index 0c2b1f772..7bdc0e658 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2174,7 +2174,7 @@
exec-sh "^0.3.2"
minimist "^1.2.0"
-"@danmarshall/deckgl-typings@^4.9.21":
+"@danmarshall/[email protected]":
version "4.9.22"
resolved "https://registry.yarnpkg.com/@danmarshall/deckgl-typings/-/deckgl-typings-4.9.22.tgz#b7044db5bd79ebb2a4f76a41f70ec59d6772d40f"
integrity sha512-kEVbNpPiqqS6NkTPAGd3Q9DgpuaMHQpsSEYVLJEYqQcfA2lwwhbjkJ1EGEQw/GbjEPpfdtQubTDxfnYNxBQ9JA==
@@ -3282,6 +3282,27 @@
resolved "https://registry.yarnpkg.com/@types/keymirror/-/keymirror-0.1.1.tgz#1fe48e6e5e2a969cafecf0f24485ae23c72abd30"
integrity sha1-H+SObl4qlpyv7PDyRIWuI8cqvTA=
+"@types/lodash.clonedeep@^4.5.7":
+ version "4.5.7"
+ resolved "https://registry.yarnpkg.com/@types/lodash.clonedeep/-/lodash.clonedeep-4.5.7.tgz#0e119f582ed6f9e6b373c04a644651763214f197"
+ integrity sha512-ccNqkPptFIXrpVqUECi60/DFxjNKsfoQxSQsgcBJCX/fuX1wgyQieojkcWH/KpE3xzLoWN/2k+ZeGqIN3paSvw==
+ dependencies:
+ "@types/lodash" "*"
+
+"@types/lodash.curry@^4.1.7":
+ version "4.1.7"
+ resolved "https://registry.yarnpkg.com/@types/lodash.curry/-/lodash.curry-4.1.7.tgz#65bb18db5557f2beb052b5b9da88e4744c77ed12"
+ integrity sha512-R+IkSvh7CI8klh7FkQuTAiAR+aPFqYrNEjw/hMxjCSO7TsAqBAxpR99PxxJN1lgE6YuvpHEoktqbh6V5VLzxZA==
+ dependencies:
+ "@types/lodash" "*"
+
+"@types/lodash.flattendeep@^4.4.7":
+ version "4.4.7"
+ resolved "https://registry.yarnpkg.com/@types/lodash.flattendeep/-/lodash.flattendeep-4.4.7.tgz#0ce3dccbe006826d58e9824b27df4b00ed3e90e6"
+ integrity sha512-1h6GW/AeZw/Wej6uxrqgmdTDZX1yFS39lRsXYkg+3kWvOWWrlGCI6H7lXxlUHOzxDT4QeYGmgPpQ3BX9XevzOg==
+ dependencies:
+ "@types/lodash" "*"
+
"@types/lodash.get@^4.4.6":
version "4.4.6"
resolved "https://registry.yarnpkg.com/@types/lodash.get/-/lodash.get-4.4.6.tgz#0c7ac56243dae0f9f09ab6f75b29471e2e777240"
@@ -3303,6 +3324,27 @@
dependencies:
"@types/lodash" "*"
+"@types/lodash.uniq@^4.5.7":
+ version "4.5.7"
+ resolved "https://registry.yarnpkg.com/@types/lodash.uniq/-/lodash.uniq-4.5.7.tgz#0773960ec0148b29e6a54821a65b878a0ebb5c1a"
+ integrity sha512-qg7DeAbdZMi6DGvCxThlJycykLLhETrJrQZ6F2KaZ+o0sNK1qRHz46lgNA+nHHjwrmA2a91DyiZTp3ey3m1rEw==
+ dependencies:
+ "@types/lodash" "*"
+
+"@types/lodash.uniqby@^4.7.7":
+ version "4.7.7"
+ resolved "https://registry.yarnpkg.com/@types/lodash.uniqby/-/lodash.uniqby-4.7.7.tgz#48dbb652c41cc8fb30aa61a44174368081835ab5"
+ integrity sha512-sv2g6vkCIvEUsK5/Vq17haoZaisfj2EWW8mP7QWlnKi6dByoNmeuHDDXHR7sabuDqwO4gvU7ModIL22MmnOocg==
+ dependencies:
+ "@types/lodash" "*"
+
+"@types/lodash.xor@^4.5.7":
+ version "4.5.7"
+ resolved "https://registry.yarnpkg.com/@types/lodash.xor/-/lodash.xor-4.5.7.tgz#a8f218586005476b5bfe14a824aca33ae3b26161"
+ integrity sha512-Drr3ZdJWjpo7dNR17QdBwgfQRh7kEhhVVdeTVX0v35bT47zpfGSDYo40Ei0oOqk5DQzzxAYuNuW0s/N3mqBwxw==
+ dependencies:
+ "@types/lodash" "*"
+
"@types/lodash@*":
version "4.14.178"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.178.tgz#341f6d2247db528d4a13ddbb374bcdc80406f4f8"