From eee25e8275c778061a9b27e32b885f14c0fc4c5b Mon Sep 17 00:00:00 2001 From: Peter Meier Date: Fri, 12 Jun 2026 23:06:25 +0200 Subject: [PATCH] fix(types): GeoJSON via explizite geojson-Imports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Kit-Bump auf 2.65 entfernte transitives @types/geojson aus dem Lockfile — CI-tsc fand den globalen GeoJSON-Namespace nicht mehr. @types/geojson als devDependency + explizite Type-Imports statt UMD-Namespace. Co-Authored-By: Claude Fable 5 --- package-lock.json | 1 + package.json | 1 + src/lib/wind-area-export.ts | 5 +++-- src/lib/windkarte.ts | 4 +++- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index d0baaba..7a4ac21 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,6 +31,7 @@ "@sveltejs/kit": "^2.65.0", "@sveltejs/vite-plugin-svelte": "^5.0.3", "@tailwindcss/vite": "^4.1.18", + "@types/geojson": "^7946.0.16", "@types/node": "^22.10.0", "@types/qrcode": "^1.5.6", "@types/sanitize-html": "^2.13.0", diff --git a/package.json b/package.json index 9c3b2e1..3dd42eb 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "@sveltejs/kit": "^2.65.0", "@sveltejs/vite-plugin-svelte": "^5.0.3", "@tailwindcss/vite": "^4.1.18", + "@types/geojson": "^7946.0.16", "@types/node": "^22.10.0", "@types/qrcode": "^1.5.6", "@types/sanitize-html": "^2.13.0", diff --git a/src/lib/wind-area-export.ts b/src/lib/wind-area-export.ts index 034e4eb..6847b20 100644 --- a/src/lib/wind-area-export.ts +++ b/src/lib/wind-area-export.ts @@ -1,4 +1,5 @@ import { env } from '$env/dynamic/public'; +import type { FeatureCollection, Geometry } from 'geojson'; import type { WindArea } from '$lib/windkarte'; const CMS_BASE = () => @@ -17,7 +18,7 @@ export function filterByGebietsNr(areas: WindArea[], id: string | null): WindAre return areas.filter((a) => a.gebiets_nr === id); } -export function toGeoJSON(areas: WindArea[]): GeoJSON.FeatureCollection { +export function toGeoJSON(areas: WindArea[]): FeatureCollection { return { type: 'FeatureCollection', features: areas @@ -51,7 +52,7 @@ function coordsToKml(ring: number[][]): string { return ring.map(([lng, lat]) => `${lng},${lat},0`).join(' '); } -function geometryToKml(geom: GeoJSON.Geometry): string { +function geometryToKml(geom: Geometry): string { if (geom.type === 'Polygon') { const [outer, ...holes] = geom.coordinates; return ` diff --git a/src/lib/windkarte.ts b/src/lib/windkarte.ts index 05defa1..248a842 100644 --- a/src/lib/windkarte.ts +++ b/src/lib/windkarte.ts @@ -1,3 +1,5 @@ +import type { Geometry } from 'geojson'; + export type TextFragment = { _slug: string; id?: string; @@ -22,5 +24,5 @@ export type WindArea = { stellungnahmeUrl?: string | null; stellungnahme_kriterien?: Array | null; notizen?: string; - geometry?: GeoJSON.Geometry; + geometry?: Geometry; };