4 ms·
Migrating millions of lines of code to TypeScript
- abdouls 4y ago> 3.7 million lines of code in a single PR Now that's crazy! They don't seem to be afraid to do major changes in one shot (yes, probably type checked because of typescript - but still, that's huge!)
- davidatbu 4y agoI absolutely love typescript! But recently, I found out about ReasonML, an ML-family language transpiled to JS that, from a distance, looks like something I'd like over TS in every aspect except one (third party typings): much more terse algebraic sum types(tagged unions), more terse code in general, incredible compile times, and named arguments[0]. To top all of that, "reason-react"[1] claims that "Reason syntax and language features are a better match for React programming patterns", and I am very inclined to agree already. I'd love to hear folks' experience with ReasonML, or pointers to blog posts such as these where companies write up their experience. [0] https://blog.dubenko.dev/typescript-vs-reason/ https://blog.dubenko.dev/typescript-vs-reason/ [1] https://reasonml.github.io/reason-react/docs/en/what-and-why https://reasonml.github.io/reason-react/docs/en/what-and-why
- goldenkey 4y agoReasonML looks interesting but how do you go about debugging it even with sourcemaps? Its types don't even have the same paradigms. The article was using strawman comparisons in some places. The getPhone example should have used optional chaining: const getPhone = (form: Form) : number | undefined => form?.user?.phone
- davidatbu 4y ago> debugging. Another point in TS's favor. > strawman's comparisons in some places Not sure, but this might be because the article was written before/around when the relevant features were merged into TS. For example, optional chaining was added to TS a month after the blog was published[0]. I do thank you for pointing that out though, as it's totally relevant. [0] https://github.com/microsoft/TypeScript/pull/33294 https://github.com/microsoft/TypeScript/pull/33294
- meitros 4y agoIt has the same creator as React as well (Jordan Walke)
- eevilspock 4y agoRecords in ReasonML are represented as arrays. And generated code looks like a human wrote it if humans could remember indices of every property of every type like a compiler does. So ReasonML is compiled into somewhat obfuscated Javascript that won't be naturally consumable by vanilla Javascript, whereas Typescript transpiles into Javascript with the same API without typings (type erasure).
- davidatbu 4y agoYes, I guess "interoperability with existing and future JS code" is a comparison that favors TS.