-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Typescript Definition #2440
Comments
Thank you @danzel! I will add this to the |
Awesome thanks :) |
I also wrote a definition file for Mapbox GL JS based on the documentation and source code, specifically arranged to work with typings. You can find it here: https://github.com/dobrud/typed-mapbox-gl. Unfortunately, I didn't spot the existing definitions of @danzel, so my work is written from scratch. |
Awesome, your one looks more complete for some of the class (especially Map!). |
I encourage you two to work to combine the best of your definition files into a single repo. Let me know how I can help! |
absolutely :) |
Hi guys, I think this is going to be super useful. However, I am having problem installing it. When I run the one from @danzel, I get:
I can install the one from @dobrud, But when I run my webpack, I get the error:
I did Thanks, |
Will have a look, it worked with typings 0.8. but not with 1.0 |
Ok, have got it working again and put a readme in the project: |
Thanks @danzel The typings install is fine now but I still can't import mapbox-gl. Getting the following error when run webpack:
|
The problem is somewhere in your webpack config. |
Yes, you are right. I've fixed it and now it works but only in the entry file of webpack. I don't think this is related to your definition file though. Thank you @danzel ! |
Sorry for the long absence. @danzel Actually I don't know why I've started with interfaces, I have now switched the interfaces to classes. During my work, I stumbled upon some flaws in the docs. What can I do to help to resolve them? Beside this I made a PR to the DefinitelyTyped library, maybe you want to have a quick look over it. |
Good stuff! For the docs you can submit a PR here, they are generated from the code, just take a read of this first: I'm unsure about having the definitions live in the DefinitelyType repository. They seem slow to merge stuff, and now that In my types I added the style definitions, they are very useful too: I'm happy to send these as a PR to yours, we should decide on the DT bit first though. |
Yeah you're right.. I didn't get the recent changes from typings 0.x to 1.x where they ditched |
I've updated my repository to the same version as in my DefinitelyTyped PR.. Feel free to make a PR with your style definitions |
If mapbox was maintaining the definitions then they should live in the mapbox-gl-js repo, if they aren't then it's better they live elsewhere, otherwise there is a good chance they'll ship broken or unsynced definitions. I'll spend some time this week and send a PR to update your definitions and then we can update the README here to point to them too :) |
@danzel @dobrud would you two be open to reconsidering having these typings exist outside of DefinitelyTyped? Here's my use case that explains why they might be better off in DT. Angular2 has moved away from using Of course I could just do this myself, just want to see if you guys are willing to buy into it. Otherwise I'll fork and contribute. |
Is there somewhere that explains the npm published typing in more detail? On Wednesday, 21 September 2016, Carlos [email protected] wrote:
|
Yea, I think its actually a simplification of type definition inclusion with TypeScript 2. http://stackoverflow.com/questions/38444279/how-should-i-use-types-with-typescript-2 The TL;DR is:
That said, |
Sorry to not have linked to a better source. Here's is a more authoritative article: |
I added the typings to DefinitelyTyped. To download them, you first need to download the geojson typings, then mapbox-gl.
|
Awesome! |
An issue is probably not the right place for this, but so people know, I've started on a typescript definition for mapbox-gl-js over here:
https://github.com/Smartrak/mapbox-gl-js-typescript
It's all manually created and very incomplete. I've just added what I need so far.
(This lets you use mapbox-gl-js with typescript)
Feel free to close this etc. I haven't seen a request for a typescript definition yet, so maybe no one cares about this, haha :P
The text was updated successfully, but these errors were encountered: