Martin Roest

TypeScript: Our approach to developing JavaScript applications

Martin Roest

TypeScript: The Ibuildings approach to developing JavaScript applications

At Ibuildings, when we do JavaScript/NodeJs development, we actually use TypeScript. TypeScript is an open-source programming language created and maintained by Microsoft. TypeScript is a superset of JavaScript which means that any JavaScript file is valid TypeScript. But why do we use TypeScript? With this post I want to share our approach to developing JavaScript applications.

As software engineers, we continuously try to achieve the highest possible code quality. We know from our experience that developing and maintaining software is a complex task. Especially when you need to debug and resolve unwanted behavior. To us, code quality means that code is readable and well structured. Individual components must have a clear responsibility. And to be readable, the code must be explicit in what it expects and what it does.

Static Typing

Searching for the highest possible quality creates the need to specify types and interfaces for your code. Since JavaScript is a dynamically typed language you cannot specify types or interfaces. Here is where TypeScript comes in. TypeScript adds types, interfaces, generics, etc. to JavaScript. Though there are other ways to specify your types and interfaces like using JSDoc or Flow, due to its popularity we chose to use TypeScript. When using an IDE that supports TypeScript the static typing will also increase your developing experience. Because in TypeScript your types are statically assigned, the IDE is able to help you do the coding. Code completion, refactorings, etc. becomes a much richer experience. Also, your IDE can let you know when you have type conflicts ie. passing the wrong type as an argument.

TypeScript = JavaScript

Since TypeScript is JavaScript with additional features you can start working with TypeScript in legacy JavaScript projects. In order to run your TypeScript code it has to be transpiled to JavaScript. TypeScript comes with a compiler that will transpile the TypeScript code into JavaScript. The transpilation is an extra step but it also allows you to make use of newer language features that aren’t available in all browsers or a NodeJS environment. By specifying a target JavaScript version, the compiler can include polyfills. That way your code will run on environments/browsers that do not have those features yet.

Learn more

You can read more about TypeScript on the TypeScript website. If you like to know more about our development process or you need help implementing TypeScript just let us know! Leave a comment below or contact me at