Skip to content

Commit f3ed2a0

Browse files
committed
1 parent d750b0c commit f3ed2a0

File tree

73 files changed

+330
-226
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+330
-226
lines changed

examples/react-map-gl-draw/style.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export function getEditHandleStyle({ feature, shape, index, state }) {
123123

124124
switch (shape) {
125125
case 'circle':
126-
//@ts-ignore
126+
// @ts-ignore
127127
style.r = CIRCLE_RADIUS;
128128
break;
129129
case 'rect':

modules/edit-modes/src/lib/draw-ellipse-by-bounding-box-mode.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class DrawEllipseByBoundingBoxMode extends TwoClickPolygonMode {
1919
const xSemiAxis = Math.max(distance(point(polygonPoints[0]), point(polygonPoints[1])), 0.001);
2020
const ySemiAxis = Math.max(distance(point(polygonPoints[0]), point(polygonPoints[3])), 0.001);
2121

22-
// @ts-ignore
22+
// @ts-expect-error ts-migrate(2322) FIXME: Type 'Feature<Polygon, { [name: string]: any; }>' ... Remove this comment to see the full error message
2323
return ellipse(centerCoordinates, xSemiAxis, ySemiAxis);
2424
}
2525
}

modules/edit-modes/src/lib/draw-ellipse-using-three-points-mode.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class DrawEllipseUsingThreePointsMode extends ThreeClickPolygonMode {
1717
const xSemiAxis = Math.max(distance(centerCoordinates, point(coord3)), 0.001);
1818
const ySemiAxis = Math.max(distance(coord1, coord2), 0.001) / 2;
1919
const options = { angle: bearing(coord1, coord2) };
20-
// @ts-ignore
20+
// @ts-expect-error ts-migrate(2322) FIXME: Type 'Feature<Polygon, { [name: string]: any; }>' ... Remove this comment to see the full error message
2121
return ellipse(centerCoordinates, xSemiAxis, ySemiAxis, options);
2222
}
2323
}

modules/edit-modes/src/lib/draw-line-string-mode.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export class DrawLineStringMode extends GeoJsonEditMode {
108108
}));
109109

110110
guides.features.push(...editHandles);
111-
// @ts-ignore
111+
// @ts-expect-error ts-migrate(2322) FIXME: Type '{ type: string; features: any[]; }' is not a... Remove this comment to see the full error message
112112
return guides;
113113
}
114114

modules/edit-modes/src/lib/draw-point-mode.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class DrawPointMode extends GeoJsonEditMode {
2424
type: 'Point',
2525
coordinates: mapCoords,
2626
};
27-
// @ts-ignore
27+
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type '{ type: string; coordinates: Pos... Remove this comment to see the full error message
2828
props.onEdit(this.getAddFeatureAction(geometry, props.data));
2929
}
3030

modules/edit-modes/src/lib/draw-polygon-by-dragging-mode.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ export class DrawPolygonByDraggingMode extends DrawPolygonMode {
3131
handleStopDragging(event: StopDraggingEvent, props: ModeProps<FeatureCollection>) {
3232
this.addClickSequence(event);
3333
const clickSequence = this.getClickSequence();
34-
// @ts-ignore
34+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'cancel' does not exist on type 'Dragging... Remove this comment to see the full error message
3535
if (this.handleDraggingThrottled && this.handleDraggingThrottled.cancel) {
36-
// @ts-ignore
36+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'cancel' does not exist on type 'Dragging... Remove this comment to see the full error message
3737
this.handleDraggingThrottled.cancel();
3838
}
3939

modules/edit-modes/src/lib/draw-polygon-mode.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export class DrawPolygonMode extends GeoJsonEditMode {
7272
}));
7373

7474
guides.features.push(...editHandles);
75-
// @ts-ignore
75+
// @ts-expect-error ts-migrate(2322) FIXME: Type '{ type: string; features: any[]; }' is not a... Remove this comment to see the full error message
7676
return guides;
7777
}
7878

modules/edit-modes/src/lib/draw-rectangle-mode.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export class DrawRectangleMode extends TwoClickPolygonMode {
88
rectangle.properties = rectangle.properties || {};
99
rectangle.properties.shape = 'Rectangle';
1010

11-
// @ts-ignore
11+
// @ts-expect-error ts-migrate(2322) FIXME: Type 'Feature<Polygon, { [name: string]: any; }>' ... Remove this comment to see the full error message
1212
return rectangle;
1313
}
1414
}

modules/edit-modes/src/lib/draw-square-from-center-mode.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class DrawSquareFromCenterMode extends TwoClickPolygonMode {
4040
square.properties = square.properties || {};
4141
square.properties.shape = 'Square';
4242

43-
// @ts-ignore
43+
// @ts-expect-error ts-migrate(2322) FIXME: Type 'Feature<Polygon, { [name: string]: any; }>' ... Remove this comment to see the full error message
4444
return square;
4545
}
4646
}

modules/edit-modes/src/lib/elevation-mode.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ export class ElevationMode extends ModifyMode {
4848
handlePointerMove(event: PointerMoveEvent, props: ModeProps<FeatureCollection>) {
4949
const editHandle = getPickedEditHandle(event.pointerDownPicks);
5050
const position = editHandle ? editHandle.geometry.coordinates : event.mapCoords;
51-
// @ts-ignore
51+
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'Record<string, any>' is not assi... Remove this comment to see the full error message
5252
super.handlePointerMove(this.makeElevatedEvent(event, position, props), props);
5353
}
5454

5555
handleStopDragging(event: StopDraggingEvent, props: ModeProps<FeatureCollection>) {
5656
const editHandle = getPickedEditHandle(event.picks);
5757
const position = editHandle ? editHandle.geometry.coordinates : event.mapCoords;
58-
// @ts-ignore
58+
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'Record<string, any>' is not assi... Remove this comment to see the full error message
5959
super.handleStopDragging(this.makeElevatedEvent(event, position, props), props);
6060
}
6161

modules/edit-modes/src/lib/extend-line-string-mode.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export class ExtendLineStringMode extends GeoJsonEditMode {
5454
const selectedLineString = this.getSingleSelectedLineString(props);
5555
if (!selectedLineString) {
5656
// nothing to do
57-
// @ts-ignore
57+
// @ts-expect-error ts-migrate(2322) FIXME: Type '{ type: string; features: any[]; }' is not a... Remove this comment to see the full error message
5858
return guides;
5959
}
6060

@@ -79,7 +79,7 @@ export class ExtendLineStringMode extends GeoJsonEditMode {
7979
coordinates: [startPosition, mapCoords],
8080
},
8181
});
82-
// @ts-ignore
82+
// @ts-expect-error ts-migrate(2322) FIXME: Type '{ type: string; features: any[]; }' is not a... Remove this comment to see the full error message
8383
return guides;
8484
}
8585

modules/edit-modes/src/lib/geojson-edit-mode.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export class GeoJsonEditMode implements EditMode<FeatureCollection, GuideFeature
8686
getTentativeGuide(props: ModeProps<FeatureCollection>): TentativeFeature | null | undefined {
8787
const guides = this.getGuides(props);
8888

89-
// @ts-ignore
89+
// @ts-expect-error ts-migrate(2322) FIXME: Type 'Readonly<GuideFeature>' is not assignable to... Remove this comment to see the full error message
9090
return guides.features.find((f) => f.properties && f.properties.guideType === 'tentative');
9191
}
9292

@@ -105,7 +105,7 @@ export class GeoJsonEditMode implements EditMode<FeatureCollection, GuideFeature
105105

106106
const isPolygonal = geometry.type === 'Polygon' || geometry.type === 'MultiPolygon';
107107
if (isPolygonal) {
108-
// @ts-ignore
108+
// @ts-expect-error ts-migrate(2322) FIXME: Type 'AllGeoJSON' is not assignable to type 'Featu... Remove this comment to see the full error message
109109
return rewind(feature);
110110
}
111111

@@ -202,10 +202,10 @@ export class GeoJsonEditMode implements EditMode<FeatureCollection, GuideFeature
202202
if (modeConfig.booleanOperation === 'union') {
203203
updatedGeometry = turfUnion(selectedFeature, feature);
204204
} else if (modeConfig.booleanOperation === 'difference') {
205-
// @ts-ignore
205+
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'Feature' is not assignable to pa... Remove this comment to see the full error message
206206
updatedGeometry = turfDifference(selectedFeature, feature);
207207
} else if (modeConfig.booleanOperation === 'intersection') {
208-
// @ts-ignore
208+
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'Feature' is not assignable to pa... Remove this comment to see the full error message
209209
updatedGeometry = turfIntersect(selectedFeature, feature);
210210
} else {
211211
// eslint-disable-next-line no-console,no-undef
@@ -277,6 +277,6 @@ export function getIntermediatePosition(position1: Position, position2: Position
277277
(position1[0] + position2[0]) / 2.0,
278278
(position1[1] + position2[1]) / 2.0,
279279
];
280-
// @ts-ignore
280+
// @ts-expect-error ts-migrate(2322) FIXME: Type 'number[]' is not assignable to type 'Positio... Remove this comment to see the full error message
281281
return intermediatePosition;
282282
}

modules/edit-modes/src/lib/measure-angle-mode.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import turfBearing from '@turf/bearing';
2-
// @ts-ignore
32
import turfCenter from '@turf/center';
4-
// @ts-ignore
53
import memoize from '../memoize';
64

75
import { ClickEvent, PointerMoveEvent, Tooltip, ModeProps, GuideFeatureCollection } from '../types';
@@ -30,7 +28,7 @@ export class MeasureAngleMode extends GeoJsonEditMode {
3028
text = formatTooltip(angle);
3129
} else {
3230
// By default, round to 2 decimal places and append units
33-
// @ts-ignore
31+
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'number' is not assignable to par... Remove this comment to see the full error message
3432
text = `${parseFloat(angle).toFixed(2)} ${units}`;
3533
}
3634

modules/edit-modes/src/lib/measure-area-mode.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export class MeasureAreaMode extends DrawPolygonMode {
1010
handleClick(event: ClickEvent, props: ModeProps<FeatureCollection>) {
1111
const propsWithoutEdit = {
1212
...props,
13-
// @ts-ignore
1413
onEdit: () => {},
1514
};
1615

@@ -33,7 +32,7 @@ export class MeasureAreaMode extends DrawPolygonMode {
3332
text = formatTooltip(area);
3433
} else {
3534
// By default, round to 2 decimal places and append units
36-
// @ts-ignore
35+
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'number' is not assignable to par... Remove this comment to see the full error message
3736
text = `${parseFloat(area).toFixed(2)} ${units}`;
3837
}
3938

modules/edit-modes/src/lib/measure-distance-mode.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export class MeasureDistanceMode extends GeoJsonEditMode {
159159
}));
160160

161161
guides.features.push(...editHandles);
162-
// @ts-ignore
162+
// @ts-expect-error ts-migrate(2322) FIXME: Type '{ type: string; features: any[]; }' is not a... Remove this comment to see the full error message
163163
return guides;
164164
}
165165

modules/edit-modes/src/lib/modify-mode.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export class ModifyMode extends GeoJsonEditMode {
6464
(lineString, prefix) => {
6565
const lineStringFeature = toLineString(lineString);
6666
const candidateIntermediatePoint = this.getNearestPoint(
67-
// @ts-ignore
67+
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'Feature<LineString, { [name: str... Remove this comment to see the full error message
6868
lineStringFeature,
6969
referencePoint,
7070
props.modeConfig && props.modeConfig.viewport

modules/edit-modes/src/lib/resize-circle-mode.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class ResizeCircleMode extends GeoJsonEditMode {
6363
(lineString, prefix) => {
6464
const lineStringFeature = toLineString(lineString);
6565
const candidateIntermediatePoint = this.getNearestPoint(
66-
// @ts-ignore
66+
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'Feature<LineString, { [name: str... Remove this comment to see the full error message
6767
lineStringFeature,
6868
referencePoint,
6969
props.modeConfig && props.modeConfig.viewport

modules/edit-modes/src/lib/rotate-mode.ts

+6-11
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ export class RotateMode extends GeoJsonEditMode {
3131
_isSinglePointGeometrySelected = (geometry: FeatureCollection | null | undefined): boolean => {
3232
const { features } = geometry || {};
3333
if (Array.isArray(features) && features.length === 1) {
34-
// @ts-ignore
35-
const { type } = getGeom(features[0]);
34+
const { type } = getGeom<any>(features[0]);
3635
return type === 'Point';
3736
}
3837
return false;
@@ -61,7 +60,7 @@ export class RotateMode extends GeoJsonEditMode {
6160

6261
coordEach(boundingBox, (coord) => {
6362
if (previousCoord) {
64-
// @ts-ignore
63+
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'number[]' is not assignable to p... Remove this comment to see the full error message
6564
const edgeMidpoint = getIntermediatePosition(coord, previousCoord);
6665
if (!topEdgeMidpointCoords || edgeMidpoint[1] > topEdgeMidpointCoords[1]) {
6766
// Get the top edge midpoint of the enveloping box
@@ -86,15 +85,11 @@ export class RotateMode extends GeoJsonEditMode {
8685
guideType: 'editHandle',
8786
editHandleType: 'rotate',
8887
});
89-
// @ts-ignore
9088
return featureCollection([
91-
// @ts-ignore
92-
polygonToLine(boundingBox),
93-
// @ts-ignore
89+
polygonToLine(boundingBox) as any,
9490
rotateHandle,
95-
// @ts-ignore
9691
lineFromEnvelopeToRotateHandle,
97-
]);
92+
]) as any;
9893
}
9994

10095
handleDragging(event: DraggingEvent, props: ModeProps<FeatureCollection>) {
@@ -175,9 +170,9 @@ export class RotateMode extends GeoJsonEditMode {
175170

176171
const centroid = turfCentroid(this._geometryBeingRotated);
177172
const angle = getRotationAngle(centroid, startDragPoint, currentPoint);
178-
// @ts-ignore
173+
// @ts-expect-error ts-migrate(2322) FIXME: Type 'AllGeoJSON' is not assignable to type 'Featu... Remove this comment to see the full error message
179174
const rotatedFeatures: FeatureCollection = turfTransformRotate(
180-
// @ts-ignore
175+
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'FeatureCollection' is not assign... Remove this comment to see the full error message
181176
this._geometryBeingRotated,
182177
angle,
183178
{

modules/edit-modes/src/lib/scale-mode.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ export class ScaleMode extends GeoJsonEditMode {
3333
_isSinglePointGeometrySelected = (geometry: FeatureCollection | null | undefined): boolean => {
3434
const { features } = geometry || {};
3535
if (Array.isArray(features) && features.length === 1) {
36-
// @ts-ignore
37-
const { type } = getGeom(features[0]);
36+
const { type } = getGeom<any>(features[0]);
3837
return type === 'Point';
3938
}
4039
return false;
@@ -85,11 +84,11 @@ export class ScaleMode extends GeoJsonEditMode {
8584

8685
const oppositeHandle = this._getOppositeScaleHandle(this._selectedEditHandle);
8786
const origin = getCoord(oppositeHandle);
88-
// @ts-ignore
87+
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'number[]' is not assignable to p... Remove this comment to see the full error message
8988
const scaleFactor = getScaleFactor(origin, startDragPoint, currentPoint);
90-
// @ts-ignore
89+
// @ts-expect-error ts-migrate(2322) FIXME: Type 'AllGeoJSON' is not assignable to type 'Featu... Remove this comment to see the full error message
9190
const scaledFeatures: FeatureCollection = turfTransformScale(
92-
// @ts-ignore
91+
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'FeatureCollection' is not assign... Remove this comment to see the full error message
9392
this._geometryBeingScaled,
9493
scaleFactor,
9594
{ origin }
@@ -220,7 +219,7 @@ export class ScaleMode extends GeoJsonEditMode {
220219
});
221220

222221
this._cornerGuidePoints = cornerGuidePoints;
223-
// @ts-ignore
222+
// @ts-expect-error ts-migrate(2322) FIXME: Type 'FeatureCollection<Point, { [name: string]: a... Remove this comment to see the full error message
224223
return featureCollection([polygonToLine(boundingBox), ...this._cornerGuidePoints]);
225224
}
226225
}

modules/edit-modes/src/lib/split-polygon-mode.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class SplitPolygonMode extends GeoJsonEditMode {
3030
// if first point is clicked, then find closest polygon point and build ~90deg vector
3131
const firstPoint = clickSequence[0];
3232
const selectedGeometry = this.getSelectedGeometry(props);
33-
// @ts-ignore
33+
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'Geometry' is not assignable to p... Remove this comment to see the full error message
3434
const feature = turfPolygonToLine(selectedGeometry);
3535

3636
const lines = feature.type === 'FeatureCollection' ? feature.features : [feature];
@@ -122,11 +122,11 @@ export class SplitPolygonMode extends GeoJsonEditMode {
122122
type: 'Point',
123123
coordinates: clickSequence[clickSequence.length - 1],
124124
};
125-
// @ts-ignore
125+
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type '{ type: string; coordinates: Pos... Remove this comment to see the full error message
126126
const isPointInPolygon = booleanPointInPolygon(pt, selectedGeometry);
127127
if (clickSequence.length > 1 && tentativeFeature && !isPointInPolygon) {
128128
this.resetClickSequence();
129-
// @ts-ignore
129+
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'TentativeFeature' is not assigna... Remove this comment to see the full error message
130130
const isLineInterectingWithPolygon = lineIntersect(tentativeFeature, selectedGeometry);
131131
if (isLineInterectingWithPolygon.features.length === 0) {
132132
return;
@@ -157,7 +157,7 @@ export class SplitPolygonMode extends GeoJsonEditMode {
157157
}
158158

159159
const buffer = turfBuffer(tentativeFeature, gap, { units });
160-
// @ts-ignore
160+
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'Geometry' is not assignable to p... Remove this comment to see the full error message
161161
const updatedGeometry = turfDifference(selectedGeometry, buffer);
162162
if (!updatedGeometry) {
163163
// eslint-disable-next-line no-console,no-undef
@@ -169,11 +169,10 @@ export class SplitPolygonMode extends GeoJsonEditMode {
169169
let updatedCoordinates = [];
170170
if (type === 'Polygon') {
171171
// Update the coordinates as per Multipolygon
172-
// @ts-ignore
173172
updatedCoordinates = coordinates.map((c) => [c]);
174173
} else {
175174
// Handle Case when Multipolygon has holes
176-
// @ts-ignore
175+
// @ts-expect-error ts-migrate(2349) FIXME: This expression is not callable.
177176
updatedCoordinates = coordinates.reduce((agg, prev) => {
178177
prev.forEach((p) => {
179178
agg.push([p]);

modules/edit-modes/src/lib/transform-mode.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export class TransformMode extends CompositeMode {
6565
}
6666
return !guidesToFilterOut.includes('scale');
6767
});
68-
// @ts-ignore
68+
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'Readonly<GuideFeature>[]' is not... Remove this comment to see the full error message
6969
compositeGuides = featureCollection(nonEnvelopeGuides);
7070
}
7171
return compositeGuides;

modules/edit-modes/src/lib/translate-mode.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export class TranslateMode extends GeoJsonEditMode {
9797
const direction = turfBearing(p1, p2);
9898

9999
const movedFeatures = turfTransformTranslate(
100-
// @ts-ignore
100+
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'FeatureCollection' is not assign... Remove this comment to see the full error message
101101
this._geometryBeforeTranslate,
102102
distanceMoved,
103103
direction
@@ -108,6 +108,7 @@ export class TranslateMode extends GeoJsonEditMode {
108108
const selectedIndexes = props.selectedIndexes;
109109
for (let i = 0; i < selectedIndexes.length; i++) {
110110
const selectedIndex = selectedIndexes[i];
111+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'features' does not exist on type 'AllGeo... Remove this comment to see the full error message
111112
const movedFeature = movedFeatures.features[i];
112113
updatedData = updatedData.replaceGeometry(selectedIndex, movedFeature.geometry);
113114
}

0 commit comments

Comments
 (0)