From 9570f2b6ea9b1f5d1b40c81339e99d83060cfcbd Mon Sep 17 00:00:00 2001 From: Dennis Sen Date: Tue, 25 Feb 2025 08:09:15 +0100 Subject: [PATCH] fix types a little --- packages/clients/diplan/src/store/module.ts | 4 ++-- .../diplan/src/store/utils/mergeMultiGeometries.ts | 12 ++---------- packages/clients/diplan/src/types.ts | 4 +++- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/packages/clients/diplan/src/store/module.ts b/packages/clients/diplan/src/store/module.ts index 0e797d04b..18e4443a1 100644 --- a/packages/clients/diplan/src/store/module.ts +++ b/packages/clients/diplan/src/store/module.ts @@ -4,7 +4,7 @@ import { generateSimpleMutations, } from '@repositoryname/vuex-generators' import { FeatureCollection } from 'geojson' -import { DiplanGetters, DiplanState } from '../types' +import { DiplanGetters, DiplanState, GeometryType } from '../types' import { mergeMultiGeometries } from './utils/mergeMultiGeometries' import { validateGeoJson } from './utils/validateGeoJson' import { enrichWithMetaServices } from './utils/enrichWithMetaServices' @@ -42,7 +42,7 @@ const diplanModule: PolarModule = { // clone to prevent accidentally messing with the draw tool's data let revisedFeatureCollection = cloneFeatureCollection( rootGetters[drawFeatureCollection] - ) + ) as FeatureCollection // No GeometryCollection from Draw // merge first; relevant for both follow-up steps if (getters.configuration.mergeMultiGeometries) { diff --git a/packages/clients/diplan/src/store/utils/mergeMultiGeometries.ts b/packages/clients/diplan/src/store/utils/mergeMultiGeometries.ts index a36b951b1..dc93dc962 100644 --- a/packages/clients/diplan/src/store/utils/mergeMultiGeometries.ts +++ b/packages/clients/diplan/src/store/utils/mergeMultiGeometries.ts @@ -1,13 +1,5 @@ -import { - Feature, - FeatureCollection, - GeoJsonTypes, - Geometry, - GeometryCollection, - Position, -} from 'geojson' - -type GeometryType = Exclude +import { Feature, FeatureCollection, GeoJsonTypes, Position } from 'geojson' +import { GeometryType } from '../../types' const isMulti = (type: GeometryType['type']) => type.startsWith('Multi') const multi = (type: GeometryType['type']) => diff --git a/packages/clients/diplan/src/types.ts b/packages/clients/diplan/src/types.ts index 7d09c8a77..7493d3ba3 100644 --- a/packages/clients/diplan/src/types.ts +++ b/packages/clients/diplan/src/types.ts @@ -1,4 +1,4 @@ -import { FeatureCollection } from 'geojson' +import { FeatureCollection, Geometry, GeometryCollection } from 'geojson' export interface MetaService { id: string @@ -21,3 +21,5 @@ export interface DiplanState { export interface DiplanGetters extends DiplanState { configuration: Required } + +export type GeometryType = Exclude