Add types for leaflet.pancontrol NPM package (#22618)

* Add types for leaflet.pancontrol NPM package

* Add typescript minimal version because of leaflet dependency
This commit is contained in:
Brictarus
2018-01-02 19:44:42 +01:00
committed by Mohamed Hegazy
parent cd3b13eb84
commit 3aa8aa9e93
4 changed files with 63 additions and 0 deletions

29
types/leaflet.pancontrol/index.d.ts vendored Normal file
View File

@@ -0,0 +1,29 @@
// Type definitions for leaflet.pancontrol 1.0
// Project: https://github.com/kartena/Leaflet.Pancontrol
// Definitions by: Brictarus <https://github.com/Brictarus>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { ControlOptions, Control as LControl } from 'leaflet';
declare module 'leaflet' {
interface MapOptions {
panControl?: boolean;
}
namespace control {
function pan(options?: Control.PanControlOptions): Control.Pan;
}
namespace Control {
interface PanControlOptions extends ControlOptions {
panOffset?: number;
}
class Pan extends LControl {
options: PanControlOptions;
constructor(options?: PanControlOptions);
}
}
}

View File

@@ -0,0 +1,9 @@
import * as L from 'leaflet';
const map = L.map('map', {
center: [51.505, -0.09],
zoom: 13,
});
const panControl = L.control.pan({position: 'topright'});
map.addControl(panControl);

View File

@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"leaflet.pancontrol-tests.ts"
]
}

View File

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