-
Notifications
You must be signed in to change notification settings - Fork 102
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
Usage with Typescript #14
Comments
Hi Ferouk, Thanks for using this plugin, glad to know it's useful to you :) Can you describe the problems or incompatibilities you encounter? |
Hi bbecquet, In order to resolve leaflet rotateMarker in Typescript, a Typings definition is required otherwise it won't be imported to the project properly. I tried to create a typings definition but I failed mainly because of the The issue is that the class Marker in The "official" Leaflet typings can't be extended, it has to be overriden. I suggest a modular approach. I mean |
Ok, this is exactly what was suggested in this previous issue #11. I personally liked the way Leaflet classes can be dynamically extended without having to create a new class, but maybe it's not suited to big real-life projects. And I understand how it conflicts with the static typing approach. I guess I'll do the shift to the modular approach when I have some time soon. After that, if you want to add a TypeScript def file to the project, I would be happy to accept a PR :) |
I am trying to migrate from angular 1 to angular 2 and was successful in creating definitely typed files for other leaflet plugins. But this one seems to be very confusing. It would be very helpful if anyone has any of using this in typescript project. |
@bbecquet I'll be glad to help @MaddyMastering A temporary alternative to migrate is by using L.divIcon with inline css |
same issue on ionic project with leaflet. |
How about writing a type definition file. this article looks interesting: https://peter.grman.at/how-to-write-typescript-definition-files/ |
Hi @Ferouk , have you managed to get a workaround for this? I am using Typescript and Angular too. |
@afeezaziz I've used L.divIcon instead with style attribute to control the icon rotation. This is an example:
|
I think this issue is already solved. Type defintions are provided here: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/leaflet-rotatedmarker See my answer on stackoverflow: https://stackoverflow.com/questions/45479872/leaflet-map-rotated-marker-for-ionic2-typescript/51063718#51063718 |
I'm currently working on an ionic2 project (Typescript) that use leaflet v1.1.0 as a map. This plugin was very useful for me in previous projects (JavaScript). I'm asking how can I use it with my typescript code? Basically, How to define it in typescript? Thanks
The text was updated successfully, but these errors were encountered: