Registry / maps / mapkit-typescript

mapkit-typescript

JSON →
library5.18.2jsnpmunverified

TypeScript type definitions for Apple MapKit JS (v5.18.2). This package provides full type declarations for the MapKit JS library, enabling static type checking and autocompletion in TypeScript projects. Maintained by the community, updated irregularly to match MapKit JS releases. Key differentiator: it is the primary source of TypeScript types for MapKit JS, as Apple does not ship official types.

maps
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MapKit JS is loaded as a global script, not an npm module. This import provides types for the global 'mapkit' object.

import * as mapkit from 'mapkit-typescript'

Map class is a property of the global mapkit object. No separate import needed.

const map = new mapkit.Map('map-id', { center: new mapkit.CoordinateRegion(...) })

CoordinateRegion is a type/constructor under the mapkit namespace.

const region: mapkit.CoordinateRegion = new mapkit.CoordinateRegion(...)

MarkerAnnotation is not a named export; use mapkit.MarkerAnnotation.

const annotation = new mapkit.MarkerAnnotation(...)

Shows how to import and use mapkit-typescript to create a MapKit JS map with a centered region and hide the compass.

// Ensure MapKit JS script is loaded in HTML: <script src="https://cdn.apple-mapkit.com/mk/5.x.x/mapkit.js"></script> import * as mapkit from 'mapkit-typescript'; const map = new mapkit.Map('map', { center: new mapkit.CoordinateRegion( new mapkit.Coordinate(37.7749, -122.4194), new mapkit.CoordinateSpan(0.1, 0.1) ), }); map.showsCompass = mapkit.FeatureVisibility.Hidden;
Debug
Known footguns
gotchaType definitions require proper typeRoots in tsconfig.json for TypeScript to find them.
gotchaImport mapkit as a namespace, not a default import. Default import will result in an empty object.
gotchaMapKit JS must be loaded via script tag before using types; types do not include the runtime.
breakingVersion 5.x changes some API signatures compared to 4.x (e.g., Map constructor options).
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
20 hits · last 30 days
gptbot
3
amazonbot
3
ahrefsbot
2
bytedance
2
Resources