Uh oh!
There was an error while loading. Please reload this page.
Typescript integration - #1915
Conversation
Complete declarations/types refactor
Update contributing doc
naftalibeder
commented
May 24, 2022
@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
mfazekas
commented
May 25, 2022
@naftalibeder thanks looks awesome! I'll try to test it tomorrow or the weekend. |
mfazekas
commented
May 31, 2022
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 |
mfazekas
commented
Jun 3, 2022
This one we should be able to work around with
Looking at |
Sync with `main`
Fix build issues
naftalibeder
commented
Jun 10, 2022
mfazekas
commented
Jun 12, 2022
@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. |
naftalibeder
commented
Jun 12, 2022
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. |
naftalibeder
commented
Jul 13, 2022
@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. |
mfazekas
commented
Jul 13, 2022
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 |
naftalibeder
commented
Jul 13, 2022
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 |
mfazekas
commented
Jul 13, 2022
That would be really helpful. |
mfazekas
commented
Jul 16, 2022
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.