shared

Porting to TypeScript Solved Our API Woes

A murb'ed feed, posted about 3 years ago filed in ruby, javascript, api & trend.

I am a typescript skeptic :) But my skepticism mostly comes from an aesthetic point of view. Also I try to limit JavaScript wherever possible, making typescript less of a necessity. But definitely, when you have loosely coupled API’s (back & front), I can definitely see how typing can work. Read more about Gary Bernhardt’s experiences with typescript.

On a more general note: There seems to be a general trend towards type systems again, but I think this is a pendulum. While this trend towards typing is happening, I think the next thing for more dynamic languages will be ML/AI assistance resolving the same errors that strong manual typing by programmers solve; partly this is already happening as languages are able to predict the types with enough typing hints present (implicit typing, type inference).

Also, I believe this typing problem is also a bigger issue in JavaScript than in Ruby (I am aware that this post is about replacing a Ruby sever, and also aware of rbs, which is a type system for ruby). Ruby’s objects typically are of a certain class, whereas Javascript often passes around unstructured classless JavaScript objects. Whenever the data structure becomes too complex for a hash typically a new class is born in ruby. Again, things you can do easily with JS as well, but serialization and simply self observed coding patterns seem to somewhat avoid that.

Go to the original link.