For the best viewing experience, please turn your phone to portrait mode.

Back to overview

Why are you migrating to TypeScript?

  • TypeScript is a superset of JavaScript, meaning it can do everything that JavaScript does, plus some additional functionality.
  • TypeScript is an open source language which first appeared in 2012, and has been gaining popularity ever since. It was voted 2017’s third most loved language in StackOverflow’s 2017 survey and was chosen by Google to build Angular 2.0 with.
  • TypeScript brings many additions to JavaScript, including: type checking, interfaces, abstract classes, algebraic data types, code refactoring, auto-completion, async functions and decorators.
  • The annual State of JavaScript surveys show the gradual rise of both popularity and usage of TypeScript among JavaScript developers. In 2018, over 45% of those surveyed have claimed that they have and would use it again, a rise from 33% just a year ago. Similarly, an additional 33% in 2018 have claimed that they have heard of TypeScript and would like to learn more.
  • TypeScript transpiles to JavaScript, meaning that when you run Lisk Elements on a server or a browser, it is JavaScript that is being compiled to machine code.
  • JavaScript does not enforce type checking, i.e. ‘is this variable a number or a string’.
  • This means that when writing JavaScript, we do not have to think about types too much. For example, we can declare a variable, without even stating what type we intend it to be. Later on, we can switch it freely to any other type. We can also create a variable and assign it to a string, which can later be re-assigned to a number or boolean.
  • This presents a problem of unpredictability in terms of how exactly an application will behave to varying types of input. If developers do not maintain a constant awareness of possible scenarios while writing code, this can lead to a type error occuring at runtime. Such failures should never occur when running mission critical Lisk applications.
  • TypeScript allows Lisk to take advantage of all the benefits of JavaScript, i.e. its use on both client and server, its vibrant open-source community and popularity, in combination with the benefits of the predictability of a statically typed language.
  • TypeScript provides a great development experience, especially within modern development environments (https://code.visualstudio.com/, http://atom.io):
  • When coding TypeScript in such an environment, type checking will occur when the code is transpiled, for example when you save, rather than when the application is run. This constant feedback allows developers to pick up on type errors earlier on and deal with them immediately, removing any chance of a type error occuring at runtime.
  • Lisk Elements, which is a collection of modules that will be used extensively by developers as part of our SDK, is a good candidate for TypeScript and ultimately will bring the aforementioned improvements to the developer experience, therefore helping us with our mission to build an accessible and secure blockchain application platform.
  • We recognize that TypeScript might not be the preference of all developers, so we will also offer the ability to develop on Lisk using regular JavaScript.
  • During the Network Economics stage of our roadmap and after all modules have been extracted and migrated to Lisk Elements, we will also migrate the remaining Lisk Core application to TypeScript.
Written by Lisk - Updated Nov 21