Skip to content

resolveMapConfig

resolveMapConfig(mapConfig, globalConfig): objectOutputType

Defined in: packages/core/src/utils/config-resolver.ts:81

Resolves a map configuration by applying global defaults.

ParameterTypeDescription
mapConfigPartial<MapConfig>The map-specific configuration (may have optional fields)
globalConfig{ dataFetching?: { defaultStrategy: "runtime" | "build" | "hybrid"; retryAttempts: number; timeout: number; }; defaultCenter?: [number, number]; defaultMapStyle?: string; defaultZoom?: number; description?: string; theme: "light" | "dark"; title?: string; }Global configuration with defaults
globalConfig.dataFetching?{ defaultStrategy: "runtime" | "build" | "hybrid"; retryAttempts: number; timeout: number; }-
globalConfig.dataFetching.defaultStrategy"runtime" | "build" | "hybrid"-
globalConfig.dataFetching.retryAttemptsnumber-
globalConfig.dataFetching.timeoutnumber-
globalConfig.defaultCenter?[number, number]-
globalConfig.defaultMapStyle?string-
globalConfig.defaultZoom?number-
globalConfig.description?string-
globalConfig.theme"light" | "dark"-
globalConfig.title?string-

objectOutputType

Resolved map configuration with all required fields

If required fields are missing after resolution

Resolution order (highest to lowest priority):

  1. Values explicitly set in mapConfig
  2. Values from globalConfig defaults
  3. Error (no silent fallbacks for center, zoom, or mapStyle)

Inherited Properties:

  • mapStyle ← globalConfig.defaultMapStyle
  • center ← globalConfig.defaultCenter
  • zoom ← globalConfig.defaultZoom

Basic Resolution

const resolved = resolveMapConfig(
{ center: [0, 0], zoom: 5 },
{ defaultMapStyle: 'https://example.com/style.json' }
);
// resolved.mapStyle === 'https://example.com/style.json'

Inherit zoom/center from global

const resolved = resolveMapConfig(
{ mapStyle: 'https://example.com/style.json' },
{ defaultCenter: [-74.006, 40.7128], defaultZoom: 10 }
);
// resolved.center === [-74.006, 40.7128]
// resolved.zoom === 10

resolveMapConfig(mapConfig, globalConfig?): objectOutputType

Defined in: packages/core/src/utils/config-resolver.ts:86

Resolves a map configuration by applying global defaults.

ParameterTypeDescription
mapConfigPartial<objectOutputType<{ antialias: ZodOptional<ZodBoolean>; attributionControl: ZodOptional<ZodBoolean>; bearing: ZodDefault<ZodNumber>; bounds: ZodOptional<ZodUnion<[ZodTuple<[ZodNumber, ZodNumber, ZodNumber, ZodNumber], null>, ZodArray<ZodNumber, "many">]>>; boxZoom: ZodOptional<ZodBoolean>; center: ZodTuple<[ZodNumber, ZodNumber], null>; crossSourceCollisions: ZodOptional<ZodBoolean>; doubleClickZoom: ZodOptional<ZodBoolean>; dragPan: ZodOptional<ZodBoolean>; dragRotate: ZodOptional<ZodBoolean>; fadeDuration: ZodOptional<ZodNumber>; failIfMajorPerformanceCaveat: ZodOptional<ZodBoolean>; fitTo: ZodOptional<ZodObject<{ maxZoom: ZodOptional<ZodNumber>; padding: ZodOptional<ZodNumber>; source: ZodString; }, "strip", ZodTypeAny, { maxZoom?: number; padding?: number; source: string; }, { maxZoom?: number; padding?: number; source: string; }>>; hash: ZodOptional<ZodBoolean>; interactive: ZodDefault<ZodBoolean>; keyboard: ZodOptional<ZodBoolean>; locale: ZodOptional<ZodRecord<ZodString, ZodString>>; localIdeographFontFamily: ZodOptional<ZodString>; logoPosition: ZodOptional<ZodEnum<["top-left", "top-right", "bottom-left", "bottom-right"]>>; mapStyle: ZodOptional<ZodUnion<[ZodString, ZodAny]>>; maxBounds: ZodOptional<ZodTuple<[ZodNumber, ZodNumber, ZodNumber, ZodNumber], null>>; maxPitch: ZodOptional<ZodNumber>; maxTileCacheSize: ZodOptional<ZodNumber>; maxZoom: ZodOptional<ZodNumber>; minPitch: ZodOptional<ZodNumber>; minZoom: ZodOptional<ZodNumber>; pitch: ZodDefault<ZodNumber>; preserveDrawingBuffer: ZodOptional<ZodBoolean>; refreshExpiredTiles: ZodOptional<ZodBoolean>; renderWorldCopies: ZodOptional<ZodBoolean>; scrollZoom: ZodOptional<ZodBoolean>; touchPitch: ZodOptional<ZodBoolean>; touchZoomRotate: ZodOptional<ZodBoolean>; trackResize: ZodOptional<ZodBoolean>; zoom: ZodNumber; }, ZodTypeAny, "passthrough">> & objectThe map-specific configuration (may have optional fields)
globalConfig?{ dataFetching?: { defaultStrategy: "runtime" | "build" | "hybrid"; retryAttempts: number; timeout: number; }; defaultCenter?: [number, number]; defaultMapStyle?: string; defaultZoom?: number; description?: string; theme: "light" | "dark"; title?: string; }Global configuration with defaults
globalConfig.dataFetching?{ defaultStrategy: "runtime" | "build" | "hybrid"; retryAttempts: number; timeout: number; }-
globalConfig.dataFetching.defaultStrategy?"runtime" | "build" | "hybrid"-
globalConfig.dataFetching.retryAttempts?number-
globalConfig.dataFetching.timeout?number-
globalConfig.defaultCenter?[number, number]-
globalConfig.defaultMapStyle?string-
globalConfig.defaultZoom?number-
globalConfig.description?string-
globalConfig.theme?"light" | "dark"-
globalConfig.title?string-

objectOutputType

Resolved map configuration with all required fields

If required fields are missing after resolution

Resolution order (highest to lowest priority):

  1. Values explicitly set in mapConfig
  2. Values from globalConfig defaults
  3. Error (no silent fallbacks for center, zoom, or mapStyle)

Inherited Properties:

  • mapStyle ← globalConfig.defaultMapStyle
  • center ← globalConfig.defaultCenter
  • zoom ← globalConfig.defaultZoom

Basic Resolution

const resolved = resolveMapConfig(
{ center: [0, 0], zoom: 5 },
{ defaultMapStyle: 'https://example.com/style.json' }
);
// resolved.mapStyle === 'https://example.com/style.json'

Inherit zoom/center from global

const resolved = resolveMapConfig(
{ mapStyle: 'https://example.com/style.json' },
{ defaultCenter: [-74.006, 40.7128], defaultZoom: 10 }
);
// resolved.center === [-74.006, 40.7128]
// resolved.zoom === 10