-
-
Notifications
You must be signed in to change notification settings - Fork 924
Typescript integration #1915
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 integration #1915
Conversation
Complete declarations/types refactor
Update contributing doc
|
@mfazekas Everything is working, passes all tests[0], and the types all seem to work. Am I missing anything?! [0] The |
Generate lib folder in prepare script
|
@naftalibeder thanks looks awesome! I'll try to test it tomorrow or the weekend. |
|
Sorry I didn't have much time to look into it. Regarding example, I could only run example after The way we run example (metro) was copied from https://github.com/software-mansion/react-native-reanimated, they also seems to be using a mix of |
This one we should be able to work around with
Looking at |
Sync with `main`
Fix build issues
|
@naftalibeder sorry I'm a bit behind with this, I could not get I've started #1981 which is the other solution to use Note that this PR is way bigger than I'm comfortable with, so I'd like to merge it in pieces. Sorry that it's taking this long and thanks for the patience. |
|
This all sounds good to me! No worries if you want to use this PR more as a template, and not actually merge it. I could see integrating the typescript pipeline first, and then merging the A lot of the complexity of this PR is refactoring the Let me know how I can help or if I’m blocking, but otherwise I’ll just wait to see what you want to do. |
|
@mfazekas I wanted to check in about this PR. What are your thoughts about when (or if?) we could start integrating this? I'm happy to bring it up-to-date with If you have any concerns that I can address, let me know. |
Hi, sorry about this, I've made some progress, I'm still not 100% about how to handle this PR exactly. So I've made some experiments and it sound like RN can consume typescript projects even if the project is just javascript. I think it's likely because of the react-native babel preset does contains typescript. Sorry I made you implement Also I've merged #2032 which does implement I've merged #2038 which generates https://github.com/rnmapbox/maps/blob/main/javascript/utils/MapboxStyles.ts, this should eventually be imported from The biggest part of this PR is Camera.js => Camera.tsx change, it's a bit hard (or more likely impossible) to review. One thing that would be nice there is if we could keep doing |
|
Great! I did find getting components to work with TS to be particularly challenging, so I'm not yet sure that the TS setup you did in those other commits is sufficient for integrating What's your thought - should I try incorporating |
That would be really helpful. |
I've also committed a new component |
See #1872. Copied here:
What's going well
./libas part of thegeneratescript. The output is a collection of.jsand.d.tsfile pairs. All file paths should be the same as before.package.jsonreferences./libas the module start location.exampleproject is set up to reference the parent package more visibly, with the file path..inexample/package.json.What's not going well
MapboxGL) Is not currently typed, so all of its properties areany. I haven't fixed this yet because... (see next).Camera.tsx) have correctly typed props, but ones that start as JS (e.g.MapView.js) give the errorJSX element class does not support attributes because it does not have a 'props' property.. I'm avoiding errors right now by referencingMapboxGL.MapView(typed asany) instead of the direct typed export.npm pack, and then reference that bynpm install-ing../<output-archive>. This behaves exactly as if it were a publicly-availablenpmpackage.To do
So to make this ready for
main, we still need:MapboxGLexport.rnmapbox/mapsinstallation (vianpm install ..) in the example project.