Skip to content

Commit

Permalink
Merge pull request #101 from Dataport/fix/narrower-type
Browse files Browse the repository at this point in the history
narrow down type for EPSG codes
  • Loading branch information
warm-coolguy authored Feb 5, 2024
2 parents b4dd6f3 + 49cee51 commit d20eb0b
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 6 deletions.
4 changes: 4 additions & 0 deletions packages/lib/getFeatures/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## unpublished

- Fix: Increase type precision of EPSG codes from `string` to `EPSG:${string}`.

## 1.0.0

Initial release.
2 changes: 1 addition & 1 deletion packages/lib/getFeatures/gazetteer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function getGazetteerFeatures(
version: WFSVersion,
memberSuffix: MemberSuffix,
namespaces: string[],
epsg: string,
epsg: `EPSG:${string}`,
options: AdditionalSearchOptions = {}
): Promise<FeatureCollection> {
let requestUrl = Object.entries(input).reduce(
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/getFeatures/gazetteer/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function parseGazetteerResponse(
response: Response,
memberSuffix: MemberSuffix,
namespaces: string[],
epsg: string,
epsg: `EPSG:${string}`,
title?: string | string[]
): Promise<FeatureCollection> {
return response.text().then((text) => {

Check warning on line 22 in packages/lib/getFeatures/gazetteer/parse.ts

View workflow job for this annotation

GitHub Actions / lint-test

Arrow function has too many lines (103). Maximum allowed is 50
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/getFeatures/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface AdditionalSearchOptions {
/** Adds the possibility to have a 'title' attribute in a GeoJSON Feature */
export interface PolarGeoJsonFeature extends GeoJsonFeature {
/** The projection of the coordinates of the features */
epsg: string
epsg: `EPSG:${string}`
/** Which fieldName to use for display purposes; e.g. used in the AddressSearch for the result list */
title?: string
}
Expand Down
4 changes: 4 additions & 0 deletions packages/lib/testMountParameters/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## unpublished

- Fix: Test now uses a mock EPSG code instead of an empty string.

## 1.2.0

- Feature: Extend mock state to match current core state type.
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/testMountParameters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default (): MockParameters => {
center: null,
components: 1,
configuration: {
epsg: '',
epsg: 'EPSG:12345',
layerConf: [],
namedProjections: [],
layers: [],
Expand Down
4 changes: 4 additions & 0 deletions packages/types/custom/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## unpublished

- Fix: Increase type precision of EPSG codes from `string` to `EPSG:${string}`.

## 1.4.0

- Feature: Add `MasterportalapiPolygonFillHatch` to `MarkerStyle` as optional fill variant.
Expand Down
4 changes: 2 additions & 2 deletions packages/types/custom/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export type SearchType = 'bkg' | 'gazetteer' | 'wfs' | 'mpapi'
*/
export interface QueryParameters {
/** Currently used projection of the map */
epsg: string
epsg: `EPSG:${string}`
/** sets the maximum number of features to retrieve */
maxFeatures?: number
// type:mpapi – these are forwarded to the masterportalApi
Expand Down Expand Up @@ -570,7 +570,7 @@ export interface MapConfig {
/** if true, all services' availability will be checked with head requests */
checkServiceAvailability?: boolean
/** The epsg code of the projection that the map will use */
epsg: string
epsg: `EPSG:${string}`
/** Configured layers */
layers: LayerConfiguration[]
/** masterportalapi-type layer configuration */
Expand Down

0 comments on commit d20eb0b

Please sign in to comment.