Skip to content

Commit f1f4960

Browse files
authored
feat(atlas): add typed topology exports for world countries (#50)
- Add AtlasWorldCountriesTopology type for world countries topology - Add typeName to world layer descriptors for accurate generated types - Switch countries-10m/50m/110m to use the specific typed alias
1 parent da2a2bf commit f1f4960

6 files changed

Lines changed: 19 additions & 7 deletions

File tree

.changeset/pink-zebras-guess.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@d3-maps/atlas': patch
3+
---
4+
5+
- Add typed `AtlasWorldCountriesTopology` export for world countries topology
6+
- Add explicit `typeName` to world layer descriptors for accurate generated types

packages/atlas/scripts/api-plan.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ function createAtlasSharedDescriptors(rootDir, { countries, continents }) {
162162
group: 'world',
163163
slug: layer.id,
164164
scales: SCALES,
165-
typeName: 'Topology',
165+
typeName: layer.typeName,
166166
}),
167167
createEntityBarrelDescriptor({
168168
rootDir,

packages/atlas/scripts/utils.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export const WORLD_LAYERS = [
5656
topologyFields: TOPOLOGY_FIELD_NAMES,
5757
propertyMode: TOPOLOGY_PROPERTY_MODE.NORMALIZE,
5858
propertyMap: TOPOLOGY_PROPERTY_MAP,
59+
typeName: 'AtlasWorldCountriesTopology',
5960
},
6061
{
6162
id: 'land',
@@ -64,6 +65,7 @@ export const WORLD_LAYERS = [
6465
theme: 'physical',
6566
topologyFields: [],
6667
propertyMode: TOPOLOGY_PROPERTY_MODE.PRESERVE,
68+
typeName: 'Topology',
6769
},
6870
{
6971
id: 'ocean',
@@ -72,6 +74,7 @@ export const WORLD_LAYERS = [
7274
theme: 'physical',
7375
topologyFields: [],
7476
propertyMode: TOPOLOGY_PROPERTY_MODE.PRESERVE,
77+
typeName: 'Topology',
7578
},
7679
{
7780
id: 'coastline',
@@ -80,6 +83,7 @@ export const WORLD_LAYERS = [
8083
theme: 'physical',
8184
topologyFields: [],
8285
propertyMode: TOPOLOGY_PROPERTY_MODE.PRESERVE,
86+
typeName: 'Topology',
8387
},
8488
{
8589
id: 'lakes',
@@ -88,6 +92,7 @@ export const WORLD_LAYERS = [
8892
theme: 'physical',
8993
topologyFields: [],
9094
propertyMode: TOPOLOGY_PROPERTY_MODE.PRESERVE,
95+
typeName: 'Topology',
9196
},
9297
{
9398
id: 'rivers',
@@ -96,6 +101,7 @@ export const WORLD_LAYERS = [
96101
theme: 'physical',
97102
topologyFields: [],
98103
propertyMode: TOPOLOGY_PROPERTY_MODE.PRESERVE,
104+
typeName: 'Topology',
99105
},
100106
]
101107

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Topology } from '../../types.ts'
1+
import type { AtlasWorldCountriesTopology } from '../../types.ts'
22
import data from './countries-10m.json' with { type: 'json' }
33

4-
export default data as unknown as Topology
4+
export default data as unknown as AtlasWorldCountriesTopology
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Topology } from '../../types.ts'
1+
import type { AtlasWorldCountriesTopology } from '../../types.ts'
22
import data from './countries-110m.json' with { type: 'json' }
33

4-
export default data as unknown as Topology
4+
export default data as unknown as AtlasWorldCountriesTopology
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Topology } from '../../types.ts'
1+
import type { AtlasWorldCountriesTopology } from '../../types.ts'
22
import data from './countries-50m.json' with { type: 'json' }
33

4-
export default data as unknown as Topology
4+
export default data as unknown as AtlasWorldCountriesTopology

0 commit comments

Comments
 (0)