Becoming a better developer with TypeScript

Having done very little work in JavaScript, our recent use of TypeScript in class has had me wondering what benefits the language brings over plain old JavaScript. In addition to the numerous concrete benefits of the language that one could look up, Llorenç Muntaner, front end engineer at Onedot, gives a different reason for using TypeScript. Muntaner’s praise for TypeScript as a language stems from his opinion that it has made him a better developer.

Types make he developer think carefully about the code.

Muntaner makes the point that adding the parameter and return types for a function makes it easier to understand, and static typing in general makes it clearer what models you are working on. This is how static typing helps a developer think about and gain a clearer understanding of their work: code becomes more easily readable, and the developer can more quickly understand and make changes to existing code.

I think that these benefits easily outweigh the “burden” of having to write the types. As someone who mostly uses Python for person projects, advocating for a language that specifically adds static typing to JavaScript may sound hypocritical but what I like about both languages is their focus on readability for developers. However both languages accomplish this goal in different ways.

One of Python’s most frequently touted features is its easy readability do to its use of plain English keywords and its lack of curly braces. This makes the language easier to read while allowing developers to focus more on what their code should be doing. TypeScript offers a different kind of readability, in almost the exact opposite way. Since TypeScript is a superset of JavaScript and generally uses its syntax, the more complete and robust syntax feels almost like its missing something without static typing. Instead of the feeling of a clean readable syntax that Python brings, JavaScript’s dynamic typing feels more like an ambiguity. TypeScript removes that feeling of ambiguity with its static typing, leaving developers to know at a glance what they’re working with.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s