mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-01 12:42:58 +08:00
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:
committed by
Mohamed Hegazy
parent
cd3b13eb84
commit
3aa8aa9e93
29
types/leaflet.pancontrol/index.d.ts
vendored
Normal file
29
types/leaflet.pancontrol/index.d.ts
vendored
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
9
types/leaflet.pancontrol/leaflet.pancontrol-tests.ts
Normal file
9
types/leaflet.pancontrol/leaflet.pancontrol-tests.ts
Normal 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);
|
||||
24
types/leaflet.pancontrol/tsconfig.json
Normal file
24
types/leaflet.pancontrol/tsconfig.json
Normal 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"
|
||||
]
|
||||
}
|
||||
1
types/leaflet.pancontrol/tslint.json
Normal file
1
types/leaflet.pancontrol/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user