How to define the type of a custom leaflet control How to define the type of a custom leaflet control typescript typescript

How to define the type of a custom leaflet control


We need to add more typings for method "extend".

Insert this code before your control declaration

declare module 'leaflet' {  namespace Control {    function extend(props: any): {new(...args: any[]): any} & typeof Control;  }}

With members

declare module 'leaflet' {  namespace Control {    function extend<T extends Object>(props: T): {new(...args: any[]): T} & typeof Control;  }}

You can add same declaration for Handler