haoliangyu/ngx-leaflet-starter

How to deal with Leaflet Plugins

CoolGeo2016 opened this issue · 2 comments

Much of leaflet plugins without type declaration file in the DefinitelyTyped repository, such as 'esri-leaflet'.
How can I deal with them,except create declaration file by myself.
Can you give some advice?

TypeScript is definitely typed so you will still need to provide some sort of type declaration.

  1. If you would like to keep the typed leaflet, you could provide a minimal type declaration for your plugin like:
/// <reference types="leaflet" />

declare namespace L {
    // no type definition, just to tell the existence of pluginFunction() at L namespace
    export var pluginFunction: any;
}
  1. or remove the type declaration of leaflet and use it like Javascript
declare var L: any;

Source: Typescript library without tsd file. Cannot instantiate class