added typings for mapbox-gl-leaflet (#25120)

* added typings for mapbox-gl-leaflet

* fixed build errors
This commit is contained in:
Alexey Gorshkov
2018-04-19 21:16:02 +03:00
committed by Ryan Cavanaugh
parent 4f374d225e
commit f0bf0a7cef
4 changed files with 61 additions and 0 deletions

20
types/mapbox-gl-leaflet/index.d.ts vendored Normal file
View File

@@ -0,0 +1,20 @@
// Type definitions for mapbox-gl-leaflet 0.0
// Project: https://github.com/brunob/leaflet.fullscreen
// Definitions by: Alexey Gorshkov <https://github.com/agorshkov23>
// 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;
}
}

View File

@@ -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 <b>Leaflet GL</b>!<br>Whoa, it works!")
.addTo(map)
.openPopup();
const gl = L.mapboxGL({
accessToken: token,
style: 'mapbox://styles/mapbox/bright-v8'
}).addTo(map);

View File

@@ -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"
]
}

View File

@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}