Skip to content

Commit

Permalink
[chore]: deck bump; remove external deck types; adjust typings (#822)
Browse files Browse the repository at this point in the history
* deck bump; remove ex types; adjust typings

* migrate to ts-expect-error; fix ts issues; more deck bump fixes

Signed-off-by: Ihor Dykhta <[email protected]>

* more ts fixes

Signed-off-by: Ihor Dykhta <[email protected]>

* fix examples

Signed-off-by: Ihor Dykhta <[email protected]>

Signed-off-by: Ihor Dykhta <[email protected]>
Co-authored-by: Alexander CherryTea <[email protected]>
  • Loading branch information
igorDykhta and Akiyamka authored Dec 14, 2022
1 parent ce4f645 commit a3f81bb
Show file tree
Hide file tree
Showing 77 changed files with 1,297 additions and 936 deletions.
10 changes: 5 additions & 5 deletions examples/advanced/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "example-advance",
"name": "example-advanced",
"private": true,
"version": "1.0.4",
"scripts": {
Expand All @@ -8,10 +8,10 @@
"types-check": "tsc --noEmit"
},
"dependencies": {
"@deck.gl/core": "^8.6.0",
"@deck.gl/layers": "^8.6.0",
"@deck.gl/mesh-layers": "^8.6.0",
"@deck.gl/react": "^8.6.0",
"@deck.gl/core": "^8.8.17",
"@deck.gl/layers": "^8.8.17",
"@deck.gl/mesh-layers": "^8.8.17",
"@deck.gl/react": "^8.8.17",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-map-gl": "^5.2.1",
Expand Down
4 changes: 2 additions & 2 deletions examples/codesandbox/getting-started/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"dependencies": {
"@deck.gl/core": "^8.6.0",
"@deck.gl/react": "^8.6.0",
"@deck.gl/core": "^8.8.17",
"@deck.gl/react": "^8.8.17",
"@nebula.gl/overlays": "0.12.0",
"@turf/helpers": "6.1.4",
"global": "4.3.2",
Expand Down
4 changes: 2 additions & 2 deletions examples/codesandbox/world-heritage/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"dependencies": {
"@deck.gl/core": "^8.6.0",
"@deck.gl/react": "^8.6.0",
"@deck.gl/core": "^8.8.17",
"@deck.gl/react": "^8.8.17",
"@nebula.gl/overlays": "^0.18.4",
"@turf/helpers": "6.1.4",
"global": "4.3.2",
Expand Down
12 changes: 6 additions & 6 deletions examples/editable-h3-cluster-layer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"start-local": "webpack-dev-server --env.local --progress --hot --open"
},
"dependencies": {
"@deck.gl/core": "^8.6.0",
"@deck.gl/layers": "^8.6.0",
"@deck.gl/geo-layers": "^8.6.0",
"@deck.gl/extensions": "^8.6.0",
"@deck.gl/mesh-layers": "^8.6.0",
"@deck.gl/react": "^8.6.0",
"@deck.gl/core": "^8.8.17",
"@deck.gl/layers": "^8.8.17",
"@deck.gl/geo-layers": "^8.8.17",
"@deck.gl/extensions": "^8.8.17",
"@deck.gl/mesh-layers": "^8.8.17",
"@deck.gl/react": "^8.8.17",
"global": "4.3.2",
"react": "16.8.6",
"react-dom": "16.8.6",
Expand Down
16 changes: 8 additions & 8 deletions examples/editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"start-local": "webpack-dev-server --env.local --progress --hot --open"
},
"dependencies": {
"@deck.gl/core": "^8.6.0",
"@deck.gl/layers": "^8.6.0",
"@deck.gl/geo-layers": "^8.6.0",
"@deck.gl/extensions": "^8.6.0",
"@deck.gl/mesh-layers": "^8.6.0",
"@deck.gl/react": "^8.6.0",
"@deck.gl/core": "^8.8.17",
"@deck.gl/layers": "^8.8.17",
"@deck.gl/geo-layers": "^8.8.17",
"@deck.gl/extensions": "^8.8.17",
"@deck.gl/mesh-layers": "^8.8.17",
"@deck.gl/react": "^8.8.17",
"react": "^16.8.0",
"react-dom": "^16.4.2",
"react-map-gl": "^5.2.1"
Expand All @@ -18,8 +18,8 @@
"@babel/core": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-export-default-from": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@babel/preset-env": "^7.9.0",
"@babel/preset-react": "^7.9.0",
"babel-loader": "^8.0.0",
"html-webpack-plugin": "^3.2.0",
"url-loader": "^1.0.1",
Expand Down
6 changes: 3 additions & 3 deletions examples/no-map/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"start-local": "webpack-dev-server --env.local --progress --hot --open"
},
"dependencies": {
"@deck.gl/core": "^8.6.0",
"@deck.gl/layers": "^8.6.0",
"@deck.gl/react": "^8.6.0",
"@deck.gl/core": "^8.8.17",
"@deck.gl/layers": "^8.8.17",
"@deck.gl/react": "^8.8.17",
"react": "^16.0.0",
"react-dom": "^16.4.2",
"react-map-gl": "^3.3.4"
Expand Down
4 changes: 2 additions & 2 deletions examples/overlays/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"start-local": "webpack-dev-server --env.local --progress --hot --open"
},
"dependencies": {
"@deck.gl/core": "^8.6.0",
"@deck.gl/react": "^8.6.0",
"@deck.gl/core": "^8.8.17",
"@deck.gl/react": "^8.8.17",
"nebula.gl": "^0.5.1",
"nebula.gl-react": "^0.5.1",
"react": "^16.0.0",
Expand Down
4 changes: 3 additions & 1 deletion examples/sf/example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { StaticMap } from 'react-map-gl';
import CSS from 'csstype';

import DeckGL from '@deck.gl/react';
import { WebMercatorViewport } from '@deck.gl/core';
import { WebMercatorViewport } from '@deck.gl/core/typed';
import { TextLayer } from '@deck.gl/layers';

import {
Expand Down Expand Up @@ -235,6 +235,7 @@ export default class Example extends React.Component<
viewState = Object.assign(viewState, { height, width });

const editableGeoJsonLayer = new EditableGeoJsonLayer({
// @ts-expect-error according to docs FeatureCollection should be valid type here
data: this.state.testFeatures,
selectedFeatureIndexes,
pickable: true,
Expand Down Expand Up @@ -294,6 +295,7 @@ export default class Example extends React.Component<
const nebulaLayers = [segmentsLayer];
const deckLayers = this.nebula.updateAndGetRenderedLayers(
nebulaLayers,
// @ts-expect-error outdated nebula.gl-react?
new WebMercatorViewport(viewState),
this
);
Expand Down
17 changes: 9 additions & 8 deletions examples/sf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
"start-local": "webpack-dev-server --env.local --progress --hot --open"
},
"dependencies": {
"@deck.gl/core": "8.6.0",
"@deck.gl/layers": "8.6.0",
"@deck.gl/react": "8.6.0",
"@luma.gl/constants": "8.5.10",
"@luma.gl/core": "8.5.10",
"nebula.gl": "^v1.0.2-alpha.0",
"@nebula.gl/edit-modes": "^v1.0.2-alpha.0",
"@nebula.gl/layers": "^v1.0.2-alpha.0",
"@deck.gl/core": "8.8.17",
"@deck.gl/layers": "8.8.17",
"@deck.gl/react": "8.8.17",
"@luma.gl/constants": "8.5.16",
"@luma.gl/core": "8.5.16",
"@luma.gl/webgl": "8.5.16",
"nebula.gl": "^1.0.4",
"@nebula.gl/edit-modes": "^1.0.4",
"@nebula.gl/layers": "^1.0.4",
"nebula.gl-react": "^0.5.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class DrawEllipseByBoundingBoxMode extends TwoClickPolygonMode {
const xSemiAxis = Math.max(distance(point(polygonPoints[0]), point(polygonPoints[1])), 0.001);
const ySemiAxis = Math.max(distance(point(polygonPoints[0]), point(polygonPoints[3])), 0.001);

// @ts-ignore
// @ts-expect-error fix return types
return ellipse(centerCoordinates, xSemiAxis, ySemiAxis);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class DrawEllipseUsingThreePointsMode extends ThreeClickPolygonMode {
const xSemiAxis = Math.max(distance(centerCoordinates, point(coord3)), 0.001);
const ySemiAxis = Math.max(distance(coord1, coord2), 0.001) / 2;
const options = { angle: bearing(coord1, coord2) };
// @ts-ignore
// @ts-expect-error fix return types
return ellipse(centerCoordinates, xSemiAxis, ySemiAxis, options);
}
}
13 changes: 9 additions & 4 deletions modules/edit-modes/src/lib/draw-line-string-mode.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { LineString, FeatureCollection } from '../geojson-types';
import { ClickEvent, PointerMoveEvent, ModeProps, GuideFeatureCollection } from '../types';
import {
ClickEvent,
PointerMoveEvent,
ModeProps,
GuideFeatureCollection,
GuideFeature,
} from '../types';
import { getPickedEditHandle } from '../utils';
import { GeoJsonEditMode } from './geojson-edit-mode';

Expand Down Expand Up @@ -80,7 +86,7 @@ export class DrawLineStringMode extends GeoJsonEditMode {

const lastCoords = lastPointerMoveEvent ? [lastPointerMoveEvent.mapCoords] : [];

const guides = {
const guides: GuideFeatureCollection = {
type: 'FeatureCollection',
features: [],
};
Expand All @@ -103,7 +109,7 @@ export class DrawLineStringMode extends GeoJsonEditMode {
guides.features.push(tentativeFeature);
}

const editHandles = clickSequence.map((clickedCoord, index) => ({
const editHandles: GuideFeature[] = clickSequence.map((clickedCoord, index) => ({
type: 'Feature',
properties: {
guideType: 'editHandle',
Expand All @@ -118,7 +124,6 @@ export class DrawLineStringMode extends GeoJsonEditMode {
}));

guides.features.push(...editHandles);
// @ts-ignore
return guides;
}

Expand Down
6 changes: 3 additions & 3 deletions modules/edit-modes/src/lib/draw-point-mode.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ClickEvent, PointerMoveEvent, ModeProps, TentativeFeature } from '../types';
import { FeatureCollection } from '../geojson-types';
import { FeatureCollection, Point } from '../geojson-types';
import { GeoJsonEditMode } from './geojson-edit-mode';

export class DrawPointMode extends GeoJsonEditMode {
Expand All @@ -20,11 +20,11 @@ export class DrawPointMode extends GeoJsonEditMode {
}

handleClick({ mapCoords }: ClickEvent, props: ModeProps<FeatureCollection>): void {
const geometry = {
const geometry: Point = {
type: 'Point',
coordinates: mapCoords,
};
// @ts-ignore

props.onEdit(this.getAddFeatureAction(geometry, props.data));
}

Expand Down
6 changes: 2 additions & 4 deletions modules/edit-modes/src/lib/draw-polygon-by-dragging-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export class DrawPolygonByDraggingMode extends DrawPolygonMode {
handleStopDragging(event: StopDraggingEvent, props: ModeProps<FeatureCollection>) {
this.addClickSequence(event);
const clickSequence = this.getClickSequence();
// @ts-ignore
// @ts-expect-error cancel() not typed
if (this.handleDraggingThrottled && this.handleDraggingThrottled.cancel) {
// @ts-ignore
// @ts-expect-error cancel() not typed
this.handleDraggingThrottled.cancel();
}

Expand Down Expand Up @@ -92,9 +92,7 @@ export class DrawPolygonByDraggingMode extends DrawPolygonMode {
}
} else if (event.key === 'Escape') {
this.resetClickSequence();
// @ts-ignore
if (this.handleDraggingThrottled) {
// @ts-ignore
this.handleDraggingThrottled = null;
}
props.onEdit({
Expand Down
7 changes: 4 additions & 3 deletions modules/edit-modes/src/lib/draw-polygon-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
ModeProps,
GuideFeatureCollection,
TentativeFeature,
GuideFeature,
} from '../types';
import { Polygon, FeatureCollection } from '../geojson-types';
import { getPickedEditHandle } from '../utils';
Expand Down Expand Up @@ -49,7 +50,7 @@ export class DrawPolygonMode extends GeoJsonEditMode {
getGuides(props: ModeProps<FeatureCollection>): GuideFeatureCollection {
const clickSequence = this.getClickSequence();

const guides = {
const guides: GuideFeatureCollection = {
type: 'FeatureCollection',
features: [],
};
Expand All @@ -59,7 +60,7 @@ export class DrawPolygonMode extends GeoJsonEditMode {
guides.features.push(tentativeFeature);
}

const editHandles = clickSequence.map((clickedCoord, index) => ({
const editHandles: GuideFeature[] = clickSequence.map((clickedCoord, index) => ({
type: 'Feature',
properties: {
guideType: 'editHandle',
Expand All @@ -74,7 +75,7 @@ export class DrawPolygonMode extends GeoJsonEditMode {
}));

guides.features.push(...editHandles);
// @ts-ignore

return guides;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class DrawRectangleFromCenterMode extends TwoClickPolygonMode {
rectangle.properties = rectangle.properties || {};
rectangle.properties.shape = 'Rectangle';

// @ts-ignore
// @ts-expect-error turf typing too wide
return rectangle;
}
}
2 changes: 1 addition & 1 deletion modules/edit-modes/src/lib/draw-rectangle-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class DrawRectangleMode extends TwoClickPolygonMode {
rectangle.properties = rectangle.properties || {};
rectangle.properties.shape = 'Rectangle';

// @ts-ignore
// @ts-expect-error turf typing too wide
return rectangle;
}
}
2 changes: 1 addition & 1 deletion modules/edit-modes/src/lib/draw-square-from-center-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class DrawSquareFromCenterMode extends TwoClickPolygonMode {
square.properties = square.properties || {};
square.properties.shape = 'Square';

// @ts-ignore
// @ts-expect-error turf typing too wide
return square;
}
}
2 changes: 1 addition & 1 deletion modules/edit-modes/src/lib/draw-square-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class DrawSquareMode extends TwoClickPolygonMode {
square.properties = square.properties || {};
square.properties.shape = 'Square';

// @ts-ignore
// @ts-expect-error turf types too wide
return square;
}
}
4 changes: 2 additions & 2 deletions modules/edit-modes/src/lib/elevation-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ export class ElevationMode extends ModifyMode {
handlePointerMove(event: PointerMoveEvent, props: ModeProps<FeatureCollection>) {
const editHandle = getPickedEditHandle(event.pointerDownPicks);
const position = editHandle ? editHandle.geometry.coordinates : event.mapCoords;
// @ts-ignore
// @ts-expect-error return type too wide
super.handlePointerMove(this.makeElevatedEvent(event, position, props), props);
}

handleStopDragging(event: StopDraggingEvent, props: ModeProps<FeatureCollection>) {
const editHandle = getPickedEditHandle(event.picks);
const position = editHandle ? editHandle.geometry.coordinates : event.mapCoords;
// @ts-ignore
// @ts-expect-error return type too wide
super.handleStopDragging(this.makeElevatedEvent(event, position, props), props);
}

Expand Down
6 changes: 2 additions & 4 deletions modules/edit-modes/src/lib/extend-line-string-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,13 @@ export class ExtendLineStringMode extends GeoJsonEditMode {
}

getGuides(props: ModeProps<FeatureCollection>): GuideFeatureCollection {
const guides = {
const guides: GuideFeatureCollection = {
type: 'FeatureCollection',
features: [],
};

const selectedLineString = this.getSingleSelectedLineString(props);
if (!selectedLineString) {
// nothing to do
// @ts-ignore
return guides;
}

Expand All @@ -79,7 +77,7 @@ export class ExtendLineStringMode extends GeoJsonEditMode {
coordinates: [startPosition, mapCoords],
},
});
// @ts-ignore

return guides;
}

Expand Down
Loading

0 comments on commit a3f81bb

Please sign in to comment.