Skip to content

Commit 2a829de

Browse files
committed
fix types issue
1 parent 48e20bb commit 2a829de

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

app/components/maps/maplibre-polygon-selector.gts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { tracked } from '@glimmer/tracking';
33
import { action } from '@ember/object';
44
import { on } from '@ember/modifier';
55
import { modifier } from 'ember-modifier';
6-
import type { Map, MapMouseEvent, LngLat } from 'maplibre-gl';
6+
import type { Map, MapMouseEvent, LngLat, GeoJSONSource } from 'maplibre-gl';
77
import FaIcon from '#ui/fa-icon.gts';
88
import { faCropSimple, faCheck, faTimes, faTrash } from '@fortawesome/free-solid-svg-icons';
99
import './polygon-selector.css';
@@ -134,6 +134,7 @@ export default class MapLibrePolygonSelector extends Component<MapLibrePolygonSe
134134

135135
if (features.length > 0) {
136136
e.preventDefault();
137+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
137138
const index = features[0]?.properties?.index;
138139
if (typeof index === 'number') {
139140
this.draggedPointIndex = index;
@@ -396,7 +397,7 @@ export default class MapLibrePolygonSelector extends Component<MapLibrePolygonSe
396397

397398
updatePreviewSource(coordinates: [number, number][]) {
398399
const map = this.args.map;
399-
const source = map.getSource(this.previewSourceId);
400+
const source = map.getSource(this.previewSourceId) as unknown as GeoJSONSource | undefined;
400401
if (source && source.type === 'geojson') {
401402
source.setData({
402403
type: 'Feature',
@@ -410,8 +411,6 @@ export default class MapLibrePolygonSelector extends Component<MapLibrePolygonSe
410411
}
411412

412413
renderPolygon() {
413-
const map = this.args.map;
414-
415414
if (this.points.length === 0) {
416415
// Clear all layers
417416
this.updatePolygonSource([]);
@@ -443,7 +442,7 @@ export default class MapLibrePolygonSelector extends Component<MapLibrePolygonSe
443442

444443
updatePolygonSource(coordinates: [number, number][][]) {
445444
const map = this.args.map;
446-
const source = map.getSource(this.polygonSourceId);
445+
const source = map.getSource(this.polygonSourceId) as unknown as GeoJSONSource | undefined;;
447446
if (source && source.type === 'geojson') {
448447
source.setData({
449448
type: 'Feature',
@@ -458,7 +457,7 @@ export default class MapLibrePolygonSelector extends Component<MapLibrePolygonSe
458457

459458
updateLineSource(coordinates: [number, number][]) {
460459
const map = this.args.map;
461-
const source = map.getSource(this.lineSourceId);
460+
const source = map.getSource(this.lineSourceId) as unknown as GeoJSONSource | undefined;;
462461
if (source && source.type === 'geojson') {
463462
source.setData({
464463
type: 'Feature',
@@ -473,7 +472,7 @@ export default class MapLibrePolygonSelector extends Component<MapLibrePolygonSe
473472

474473
updatePointsSource(points: PolygonPoint[]) {
475474
const map = this.args.map;
476-
const source = map.getSource(this.pointsSourceId);
475+
const source = map.getSource(this.pointsSourceId) as unknown as GeoJSONSource | undefined;;
477476
if (source && source.type === 'geojson') {
478477
source.setData({
479478
type: 'FeatureCollection',

0 commit comments

Comments
 (0)