diff --git a/types/leaflet.pancontrol/index.d.ts b/types/leaflet.pancontrol/index.d.ts new file mode 100644 index 0000000000..6e06aa9c54 --- /dev/null +++ b/types/leaflet.pancontrol/index.d.ts @@ -0,0 +1,29 @@ +// Type definitions for leaflet.pancontrol 1.0 +// Project: https://github.com/kartena/Leaflet.Pancontrol +// Definitions by: 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); + } + } +} diff --git a/types/leaflet.pancontrol/leaflet.pancontrol-tests.ts b/types/leaflet.pancontrol/leaflet.pancontrol-tests.ts new file mode 100644 index 0000000000..029fcfa890 --- /dev/null +++ b/types/leaflet.pancontrol/leaflet.pancontrol-tests.ts @@ -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); diff --git a/types/leaflet.pancontrol/tsconfig.json b/types/leaflet.pancontrol/tsconfig.json new file mode 100644 index 0000000000..ec286c0305 --- /dev/null +++ b/types/leaflet.pancontrol/tsconfig.json @@ -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" + ] +} diff --git a/types/leaflet.pancontrol/tslint.json b/types/leaflet.pancontrol/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/leaflet.pancontrol/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }