leaflet-ant-path
leaflet-ant-path copied to clipboard
Usable in a TypeScript project?
Type:
- [ ] bug
- [X ] feature
- [ ] enhancement
- [ ] question
Environment:
- OS: *
- Browser: *
- Library Version: *
I'm going to open a PR:
- [ ] yes
- [ X] no
Description: Hello, I'd like to know if there is a way to use it in a typescript project? I didn't find any declaration module so I receive this error when trying to import it:
"Could not find a declaration file for module 'leaflet-ant-path'. "
Thanks
Ok I actually found out how to import in my typescript project (in this case, Ionic).
I created a decs.d.ts in the root folder of my project:
declare module "leaflet-ant-path"
In tsconfig.app.json i completed the following parameter in the include:
"include": [ "src/**/*.d.ts", "decs.d.ts" ]
In the file I want to use the plugin i import it like that:
import { AntPath, antPath } from 'leaflet-ant-path';
And make an animated polyline appear on the map like that:
let antPolyline = antPath([startPoint, endPoint], {}); antPolyline.addTo(this.map);
Btw, it would be awesome if there was a declaration type for this plugin so it's easier to use it. Hope it can help someone else.