Leaflet is a JS library that contains an existing TypeScript definition file.
I'd want to utilise a plugin that adds an extra function to some of the leaflet objects.
The objects are declared as classes rather than interfaces in the existing TypeScript definition file.
e.g.
declare module L {
function circleMarker(latlng: LatLng, options?: PathOptions): CircleMarker;
export class CircleMarker extends Circle {
constructor(latlng: LatLng, options?: PathOptions);
setLatLng(latlng: LatLng): CircleMarker;
setRadius(radius: number): CircleMarker;
toGeoJSON(): any;
}
}
If I try and define it a second time in a separate file then I get an error about "Duplicate Identifier 'CircleMarker'.".
declare module L {
export class CircleMarker {
bindLabel(name: string, options: any): CircleMarker;
}
}
This makes sense because it's a class rather than an interface, but is there a method to modify the class definition without affecting the original definition file?
I don't want to modify the basic definition file because it's pulled in from DefinitelyTyped via nuget, and it'll make upgrading much more difficult/prone to failure.