r/programming • • Jun 19 '18

Airbnb moving away from React Native

https://medium.com/airbnb-engineering/react-native-at-airbnb-f95aa460be1c
2.5k Upvotes

581 comments sorted by

View all comments

Show parent comments

3

u/Woolbrick Jun 20 '18

you have to restrict your way of writing code for the numerous limitations of the type system.

In my experience, if you're writing code too complex to represent in TypeScript's type system, you're writing code too complex for you or a maintainer to understand 6-18 months from now.

Your first thought shouldn't be "it's too hard to write this in TypeScript", it should be "I'm designing this really badly".

1

u/UmbrellaHuman Jun 20 '18 edited Jun 20 '18

It is far too simple to say that the space of TS/Flow supported code is similar to the space of maintainable code.

In Flow any function removes a type refinement check. filter does not work for type refinement. You have a hard time to write custom type refinement functions, there is an official hack but it is very limited. To Flow, inner functions are expected to mutate anything in the outer context, even if they don't and a "pure". Stuff like that - it has little to do with "complex code". It's still just as easy to write unmaintainable and complex code, a type system offers little help here. Just check out the issues sections for TS and Flow, plenty of good and simple stuff can be found that causes issues.