I guess this should be covered by TypeScript documentation:
how to import a JavaScript library that does not have type definition yet.
Looking at other type definitions, you should be able to write a *.d.ts file with contents like:
import {TileLayer, TileLayerOptions} from 'leaflet';
declare module 'leaflet' {
namespace tileLayer {
function fallback(url: string, options?: TileLayerOptions): TileLayer;
}
}
Reference this definition file in your TypeScript project configuration, then in your script you can import and use:
import * as L from 'leaflet';
import 'leaflet.tilelayer.fallback';
L.tileLayer.fallback(url, options);
For further help on how to use this library, especially in a configuration with some framework (e.g. Angular), please ask for help on Stack Overflow. You will reach a much wider audience there.
Hi,
I guess this should be covered by TypeScript documentation: how to import a JavaScript library that does not have type definition yet.
Looking at other type definitions, you should be able to write a
*.d.ts
file with contents like:Reference this definition file in your TypeScript project configuration, then in your script you can import and use:
For further help on how to use this library, especially in a configuration with some framework (e.g. Angular), please ask for help on Stack Overflow. You will reach a much wider audience there.