React-native-mapbox-gl: Add TypeScript Support

Created on 8 Jan 2018  路  17Comments  路  Source: nitaliano/react-native-mapbox-gl

The JS portion of this codebase is rather small, but updating it to use flow will help make the code more self documenting and will improve the information that we have about our data types when generating documentation

enhancement

Most helpful comment

@hannta if enough people want typescript support we can add support for it

All 17 comments

How about supporting typescript? I think there should be at least typescript typing's included in this lib.

@hannta if enough people want typescript support we can add support for it

Definitely using typescript in my project. Always added the definitions for the functions I needed manually but I would like to have a typescript support

Typescript would be great to have for this project, unless someone would want to work on a @types file for this project?

Typescript has so much more than Flow. Check for example why big company Lyft chose TS over Flow: https://eng.lyft.com/typescript-at-lyft-64f0702346ea

I love how all comments and likes for this issue are related to Typescript. One of my main concerns with using Typescript directly is we use react-docgen to help generate our docs, and it's going to be even more important once we release our html docs, Typescript is not supported out of the box.

With Typescript you don't need HTML docs :P

I'm going to hold off on supporting flow for now, I've been using TypeScript more and it has been growing on me and I'm seriously thinking about moving the codebase over to TypeScript instead of flow. We would just pick another library to help us generate docs, it's not a good enough argument to hold us back from using it.

Does anyone have any strong feelings of flow over typescript?

We have been using TS for some time now and it has the best so far in my JS career <3

Currently using react-native-mapbox-gl in a Typescript project, and maintaining custom local typings was a (very very mild) annoyance with the 6+ update (since https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mapbox__react-native-mapbox-gl doesn't exist).

To see official support would be absolutely lovely.

I need TypeScript definition files for this project. @edwardgalligan could you create a PR to here or paste in a gist? Did you build on the previous PR? https://github.com/mapbox/react-native-mapbox-gl/pull/613/files

@ctaggart on hiatus until May but will take a look what I have locally and upload something as soon I can. They weren't based on @madroneropaulo's work so there'll be overlap/combination most likely.

TypeScript +1

We'll officially support TypeScript, only one person so far as asked for flow support and I also prefer TypeScript more now after using it more 馃槃

I won't be actively developing anything for this repo until June but once I come back I can help out with the current efforts to add support for this.

For anyone that does attempt to write type definitions for layers and their style properties we are autogenerating all of the code from the style spec https://github.com/mapbox/react-native-mapbox-gl/blob/master/scripts/templates/styleMap.js.ejs so in theory this should be very easy to also include a template to autogenerate the type definitions for the layers and styles. Then when we upgrade to the newest native sdks we only need to run npm run generate to get the updated type definitions instead of having to hand write them

So, this is already implemented or still waiting?

I've started by mapping the prop types as recommended in https://github.com/mapbox/react-native-mapbox-gl/pull/1526 - happy to have someone get those prop types into the components.

We'll be accepting PRs for typescript and flowtype. Please keep them coming @orta or anyone else! I'll close this ticket in an effort to reduce old open tickets.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Amalp picture Amalp  路  3Comments

EugenePisotsky picture EugenePisotsky  路  4Comments

alexisohayon picture alexisohayon  路  4Comments

lernerbot picture lernerbot  路  3Comments

igor9silva picture igor9silva  路  3Comments