diff --git a/types/mapbox-gl-leaflet/index.d.ts b/types/mapbox-gl-leaflet/index.d.ts new file mode 100644 index 0000000000..34e3578eac --- /dev/null +++ b/types/mapbox-gl-leaflet/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for mapbox-gl-leaflet 0.0 +// Project: https://github.com/brunob/leaflet.fullscreen +// Definitions by: Alexey Gorshkov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as L from 'leaflet'; + +declare module 'leaflet' { + class MapboxGL extends Layer { + constructor(options: MapboxGLOptions); + } + + function mapboxGL(options: MapboxGLOptions): MapboxGL; + + interface MapboxGLOptions { + accessToken: string; + style: string; + } +} diff --git a/types/mapbox-gl-leaflet/mapbox-gl-leaflet-tests.ts b/types/mapbox-gl-leaflet/mapbox-gl-leaflet-tests.ts new file mode 100644 index 0000000000..3c8bc6a207 --- /dev/null +++ b/types/mapbox-gl-leaflet/mapbox-gl-leaflet-tests.ts @@ -0,0 +1,14 @@ +import * as L from 'leaflet'; + +const token = 'token'; + +const map = L.map('map').setView([38.912753, -77.032194], 15); +L.marker([38.912753, -77.032194]) + .bindPopup("Hello Leaflet GL!
Whoa, it works!") + .addTo(map) + .openPopup(); + +const gl = L.mapboxGL({ + accessToken: token, + style: 'mapbox://styles/mapbox/bright-v8' +}).addTo(map); diff --git a/types/mapbox-gl-leaflet/tsconfig.json b/types/mapbox-gl-leaflet/tsconfig.json new file mode 100644 index 0000000000..0eef6c85dd --- /dev/null +++ b/types/mapbox-gl-leaflet/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "strictNullChecks": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "mapbox-gl-leaflet-tests.ts" + ] +} \ No newline at end of file diff --git a/types/mapbox-gl-leaflet/tslint.json b/types/mapbox-gl-leaflet/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/mapbox-gl-leaflet/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +}