Skip to content

Commit

Permalink
fix types a little
Browse files Browse the repository at this point in the history
  • Loading branch information
warm-coolguy committed Feb 25, 2025
1 parent 76f723b commit 9570f2b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
4 changes: 2 additions & 2 deletions packages/clients/diplan/src/store/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -42,7 +42,7 @@ const diplanModule: PolarModule<DiplanState, DiplanGetters> = {
// clone to prevent accidentally messing with the draw tool's data
let revisedFeatureCollection = cloneFeatureCollection(
rootGetters[drawFeatureCollection]
)
) as FeatureCollection<GeometryType> // No GeometryCollection from Draw

// merge first; relevant for both follow-up steps
if (getters.configuration.mergeMultiGeometries) {
Expand Down
12 changes: 2 additions & 10 deletions packages/clients/diplan/src/store/utils/mergeMultiGeometries.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import {
Feature,
FeatureCollection,
GeoJsonTypes,
Geometry,
GeometryCollection,
Position,
} from 'geojson'

type GeometryType = Exclude<Geometry, GeometryCollection>
import { Feature, FeatureCollection, GeoJsonTypes, Position } from 'geojson'
import { GeometryType } from '../../types'

const isMulti = (type: GeometryType['type']) => type.startsWith('Multi')
const multi = (type: GeometryType['type']) =>
Expand Down
4 changes: 3 additions & 1 deletion packages/clients/diplan/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FeatureCollection } from 'geojson'
import { FeatureCollection, Geometry, GeometryCollection } from 'geojson'

export interface MetaService {
id: string
Expand All @@ -21,3 +21,5 @@ export interface DiplanState {
export interface DiplanGetters extends DiplanState {
configuration: Required<DiplanConfiguration>
}

export type GeometryType = Exclude<Geometry, GeometryCollection>

0 comments on commit 9570f2b

Please sign in to comment.