Angular with Typescript or Javascript?

Asked

Viewed 2,946 times

3

Researching a little about Angular (v 2+) saw that in many places it is commented that Angular has support for Typescript and that its use is more common than pure Javascript, so what are the advantages and disadvantages of using Typescript or Javascript in Angular?

  • 1

    For me this goes from each one, I enjoyed the TypeScript, for me is nothing more than a Javascript improved!

  • @Noobsaibot had already seen this question but I found it too comprehensive, I would like something more specific

  • At the end of the day, everything becomes Javascript rsrs

  • I don’t really see much point in using a language that, as you said yourself, is javascript at the end, but if to be able to do something cool with Angular + JS I have to spend a week smashing my head and with TS I do in a few minutes, ends up being a necessity

  • That question of yours is actually pretty easy to answer. Try to make a feature in an application using Angular, React, Vue, etc... applying the object orientation paradigm with Typescript and then the same functionality using Vanila.

  • The typescript and so additional Features on typescript for example vc can use any anywhere and would be pretty much the same thing as js.

  • 1

    @Eduardovargas and if use, better not do :)

Show 3 more comments

1 answer

4


Specifically by Angular the advantage is to use the same language as it is written.

The biggest advantage is that the language is statically typed (at least on the surface), which makes the code more scalable than dynamic typing. Dynamic typing is for scripts, works well when JS was used to scripts, when they started making applications on it got complicated. Typescript gives more robustness.

And of course the language has more Features, has evolved very fast because it is not a committee language. I do not know what the future of Angular with the advent of Webassembly, may be that many people even opt for a solution that uses neither JS, nor TS, nor Angular.

To see general differences you can consult: Coffeescript, Typescript and Javascript.

The downside is that it’s one more layer, you program in a language that will be converted to another. With the existing tools they managed to do something surprisingly good.

Some time after the answer you can say that everyone is going to Typescript (or leave the entire ecosystem). Some will take longer and will not drop the bone, but it is clear that the type of application that Angular is used TS is much better, even if you can still use JS. The same goes for Vue and React, as these took longer to support TS, the adoption is slower.

  • I didn’t know Angular was written in Typescript. In his experience, using Typescrit in Angular can end up becoming a necessity, for ease, for being more used, for having more content, or even because in some future version Angular can only be used with TS?

  • 1

    The current Angular yes, the first no. I do not know if it would be necessary, but it is more natural. JS and TS are very compatible, at least in one direction, I don’t think it changes much, and as I said it’s easier for Angular to become irrelevant. It is possible that the TS end up dominating, but these things can not predict.

  • What do you mean "Typescript gives more robustness."? If in the end everything is Javascript, do something in JS or TS, in the end, would not give in the same robustness, performance, etc?

  • 1

    In no way, robustness has to do with the way you write, it’s not that in the end it’s all the same thing, at most in the end it turns into the same language, but not in the same code. It is possible in theory to have the same result, but in practice it does not happen.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.