TypeScript in Foreman

Hello,

during the weekend I was trying to catch up my huge JavaScript gap by reading some stuff about modern JS and I stumbled upon TypeScript. I understand that it can boost up productivity by adding type annotations and compile-level checks and it works well with all JS ecosystem. Most bloggers recommend it for larger projects. If I am not mistaken, we do not use TS at all. So I am wondering, have we evaluated that possibility? What was the outcome? I am just curious since we already use Babel I suppose.

1 Like

FWIW, I’d be in favor of using TS.

1 Like

Thank you for opening this thread @lzap.

I have been using typescript in some projects and TBH I always had mixed feelings about it.
It was great when it worked but annoying when didn’t (and it happen quit often for me).
When I speak with developer who work with typescript today, most of them has mixed feelings about typescript as well, one day the love it and one day they hate it :confused:

Basically it should be possible to build using ts without migrating the code.

TypeScript seems to be super trendy now in the JavaScript community. For React specifically, I’ve heard that it replaces and extends the benefits we get from using PropTypes. Also, I’ve heard people say TypeScript can probably provide some of the protection of all the unit tests we should be writing but aren’t (not to say we don’t write unit tests, just that we probably don’t have enough.)

But there are always tradeoffs – My concerns would be that TypeScript would be yet another technology added to the patchwork that is the Foreman project, and also I’m not sure whether the learning curve etc. would be worth it.

Basically TypeScript tries to turn JavaScript into a statically typed language like Java… do people think that would be worth it? Personally I’m leaning towards sticking with regular JS. Until we figure out a way to move toward a clean and well-organized code base, I don’t think we should add another new technology to it.

4 Likes

Disclaimer: The amount of experience I have with TS is almost the same as with regular JS (hint: near to none).

I’d say that anything that can help prevent spurious undefined e[t]s at runtime and blank pages being shown is a good thing. The cost can’t be that high, right?

This looks like good reading: https://medium.com/javascript-scene/the-typescript-tax-132ff4cb175b

The author argues that code review, TDD, and other measures provide most of the benefits of TypeScript, and that the cost usually isn’t worth it. Obviously we have to decide that for ourselves though. I actually haven’t used TypeScript so I’d be interested to hear from anyone who has.