Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usable in a TypeScript project? #177

Open
4 tasks
Sulorb opened this issue Sep 29, 2023 · 1 comment
Open
4 tasks

Usable in a TypeScript project? #177

Sulorb opened this issue Sep 29, 2023 · 1 comment

Comments

@Sulorb
Copy link

Sulorb commented Sep 29, 2023

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

@Sulorb
Copy link
Author

Sulorb commented Sep 29, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant