DEV Community

Discussion on: Is TypeScript Really... A Language??

Collapse
 
hugecoderguy profile image
Christian Kreiling • Edited

Whether or not TypeScript is a programming language isn't so much up for debate, in my opinion. It's a JS superset, so all JavaScript is also valid TypeScript, but not vice-versa. This is because TypeScript is gradually typed - a cool area of research if you ask me.

I think a more adventurous question to ponder is whether or not TypeScript is a suitable replacement for JavaScript for developing applications that run on a standalone JS engine (e.g. Node) or in a browser. I think a useful approach to this question is to think about the pros vs. cons of JavaScript, and seeing how many pros hold up and how many cons go away by simply adding TypeScript.

Rather than get into that debate, I'd like to point out some frontend alternatives to developing in JavaScript and TypeScript:

  • Phoenix LiveView: some would argue we've gone full-circle in web dev - everything was rendered on the server (SSR), then everything was rendered on the client (SPA), and now we've come to realize that a hybrid approach is probably best for 90+% of new projects. LiveView not only brings server-side rendering back, but also manages client-side state on the server. It's a no-JavaScript, just-add-water approach to rich client experiences.
  • Elm lang: Elm is a functional, immutable language that also compiles to JavaScript. Though it's a language, it is also like a framework in that its underlying architecture is reactive, i.e. events and event handlers are pretty much language primitives. This is so powerful because there's no architecturally complex rendering layer between the developer and the language, such as React and Angular.

Personally, I think that TypeScript is a popular embodiment of very interesting research into gradual typing, but not much more. Adding types to JavaScript is definitely a cool feat (in the 90's I bet it'd have been a dream), but it does not solve many problems that are inherent to developing in JavaScript like evaluating variable equality and lack of an intuitive & expressive concurrency model. Dynamic vs static typing is a matter of preference - there is not and never will be a winner or a loser in that debate. Instead I think it's more productive to look at other modern languages like Go and Elixir, and ask ourselves whether or not TypeScript really compares to them. My short and sweet answer to that is no, it does not :)