From 20235151e833ee2a7bf5a4fadb254f028c5ef5bd Mon Sep 17 00:00:00 2001 From: Ryan Blace Date: Fri, 13 Jan 2017 12:29:53 -0500 Subject: [PATCH] [Leaflet] Making an L.Control class that extends L.Class so you can extend Control (#13954) * Need to make static Class functions available on Control so you can extend Control class * The latest leaflet 0.7.x added the PositionString type to the L namespace * Specifying Control to only be a class that extends Class * Synching back the mapzen changes --- leaflet/index.d.ts | 2 +- leaflet/leaflet-tests.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/leaflet/index.d.ts b/leaflet/index.d.ts index 71f7c1824a..334c8953a0 100644 --- a/leaflet/index.d.ts +++ b/leaflet/index.d.ts @@ -963,7 +963,7 @@ declare namespace L { position?: ControlPosition; } - export interface Control { + export class Control extends Class { getPosition(): ControlPosition; setPosition(position: ControlPosition): this; getContainer(): HTMLElement; diff --git a/leaflet/leaflet-tests.ts b/leaflet/leaflet-tests.ts index b36337aa6c..ec38b292cb 100644 --- a/leaflet/leaflet-tests.ts +++ b/leaflet/leaflet-tests.ts @@ -390,3 +390,10 @@ class MyDivIcon extends L.DivIcon { super(); } } + +let myControlClass = L.Control.extend({}); +let myControl = new myControlClass(); + +L.Control.include({}); +L.Control.mergeOptions({}); +L.Control.addInitHook(() => {});