What Is TypeScript?
Created and maintained by Microsoft, TypeScript is an open-source programming language that is not only one of the most popular ones but is also incredibly fast-growing.
The learning curve for TypeScript is shallow, as it is very similar to JavaScript. This programming language was created to be a superset of JavaScript, meaning that it offers full JavaScript compatibility but builds on the older language with new capabilities. In other words, all existing JavaScript apps are automatically valid TypeScript apps.
What makes TypeScript stand out is that it is packed with more powerful features that help developers create large-scale applications. Also, TypeScript is supported by Microsoft's free code editor Visual Studio Code, the top open-source project on GitHub.
History of Creating TypeScript
TypeScript is a relatively new programming language. It was launched for public use in October 2012 as version 0.8 of the language. Before it was officially released, TypeScript was in development for two years by Microsoft and Anders Hejlsberg, the lead architect of C# and the creator of Delphi and Turbo Pascal.
TypeScript started gaining immense popularity in 2019, shortly after it was proclaimed the 12th most popular programming language by developer analyst RedMonk. That same year, Stack Overflow conducted an online survey, and TypeScript was voted one of the top three most loved programming languages that deal with JavaScript.
Today, TypeScript is a dominant open-source language with a steadily growing community. Millions of developers love it, and the fact that this programming language is backed by Microsoft conveys confidence that it won’t be abandoned any time soon.
Now that you’re more familiar with TypeScript basics let’s find out the advantages of using TypeScript.
TypeScript Advantages
The main feature of TypeScript is that it supports static typing. It improves the quality and understanding of the code and makes it easier to catch errors. Moreover, TypeScript is an irreplaceable tool when working with teams and several developers.
Let’s closely look at the list of the other top advantages of using TypeScript:
TypeScript Simplifies the Familiarity with the Project
One of the benefits of TypeScript for large projects is that different people and teams can easily support it. Explicitly specified data structures and type annotations make it far easier to understand the decisions made by the engineers who wrote the code. In other words, it is possible to introduce new developers to projects much faster with TypeScript.
TypeScript Minimizes the Number of Errors During the Development Phase
In contrast to JavaScript, TypeScript enables developers to evade errors and do rewrites more easily. A recent study shows that 15% of all JavaScript bugs can be detected by TypeScript. So, another significant TypeScript benefit is that it minimizes the number of errors during the development phase.
The language can warn the user about type errors in the code. Since the errors are found by the editor, not by the user or the compiler, there’s no need for developers to perform a build, saving them a great deal of time.
The Open Source Is Supported by a Strong Development Team
TypeScript is also backed by some of the most powerful names in the software industry. Slack, Asana, and Visual Studio Code are just a few examples of software that employ the language.
Furthermore, many amazing JavaScript tools, such as frameworks (Angular, Aurelia, or Ionic) and libraries, are developed in TypeScript (ZoomCharts, yWorks, or GoJS). Even tech giants such as Microsoft, JetBrains, eBay, Ericsson, and Ubisoft have all publicly said that they use TypeScript.
The TypeScript community is continuously growing, so users have constant support from a strong development team.
TypeScript Is Supported by All Modern JavaScript Versions
JavaScript is a subset of TypeScript, meaning developers can use all JavaScript libraries and add their TypeScript code. Most popular JavaScript libraries have types. For example, Definitely Typed is a repository with types for numerous JavaScript libraries that developers can use to make their interactions with them more type safe.
Working with Data Is Much Easier
There are numerous benefits to using TypeScript, but all developers appreciate that it makes working with data much easier. TypeScript code, in contrast to JavaScript, is more dependable and easier to refactor. This makes it considerably easier for developers to avoid errors and perform rewrites.
Convenient Development Tools
TypeScript includes quite a few tools that increase productivity and make the creation of large codebases much easier. In addition, this programming language allows developers not to use unit tests in the project. With TypeScript (TS), everything stays the way it was initially defined. Definitions written by TS can replace documentation in many cases.
Why Use Typescript for EdTech Development?
Since we covered the basics and benefits of TypeScript, let’s talk about the uses of this programming language for EdTech projects.
What is EdTech?
The word “EdTech” is a blend of two words — education and technology. The term refers to the process of combining IT tools and educational practices to facilitate and enhance learning.
Thanks to EdTech, it is possible to create a more engaging, inclusive, and individualized learning experience for students. Some examples of EdTech would be creating tech-infused classrooms with tablets, interactive online courses, and even computers that can take notes and record lectures for students who are ill.
TypeScript Advantages for Developers of an EdTech Project
One of the most demanding tasks for developers is supporting a finished product without high-quality documentation.
It takes additional time to understand what each line of code represents, why certain data is passed to a certain component, why a database requires a specific format, and so on. With TypeScript, developers don’t need to spend extra time to understand the existing base or introduce it to other developers.
In the following paragraphs, we’ll show you an example of a piece of code written in the TypeScript extension and another written in JavaScript.
Example with JavaScript
This snippet of code shows a component that is responsible for rendering a small block with a button. In order to display these elements on a web page, a popular library called React.js was used.
The component takes a message parameter. Inside the block, there is an option to click on a button called the someActionFunction function, which takes a message parameter as an argument.
To understand what kind of data is used, it is necessary to do a few things with an app.
EDIT - To display specific data for this piece of code, special log functions should be used that display the exact information about the message in live mode.
COMPILE - After the logs have been made to the code, the project must rebuild itself and make new changes.
RUN - Then, it is necessary to run the project to see in the developer tools what kind of data is displayed in the message.
Now, let's explore the next piece of code, which is responsible for the someActionFunction.
In this file, it's clear that two functions are being called—one for adding an event to Google analytics and the second for communicating with a server.
After seeing this, every developer will want to know whether the entire message object should be passed to the database or only certain keys.
The standard EDIT > COMPILE > RUN procedure has to be carried out to resolve this issue.
Why did we show you this example? So you could understand how much time it takes to test any piece of code. But this example is just a small segment. What if you need to understand the behavior of a project that has been in development for more than six months?
That’s where an EdTech project written in TypeScript can make things much more manageable.
Example with TypeScript
With this example in TypeScript, developers will immediately notice a complete description of the data received into this component.
The message structure is easy to understand; it is an object that has four keys with corresponding values—two strings, one number, and one boolean.
Developers can immediately be sure of the data structure that the someActionFunction receives. Without looking at the block of this function yet, developers can also realize that the code is working with the keys of this object.
Now, let's see what happens with this function, which is also described using TypeScript.
The conclusion here is that only the ID key is required for communication with the database. For analytics, there is a corresponding value, which is boolean; if it is true, then we call the function and save the user's click in the analytics. The picture is now completely clear.
These two examples show how developers can catch up with an EdTech project much faster when TypeScript is used.
Now, let’s explore how project owners can reap TypeScript benefits.
TypeScript for the Owner of an EdTech Project
EdTech project owners might find themselves wondering why use TypeScript for EdTech projects. The previous examples answer this question very well.
It is important to point out that EdTech projects are not only frontend and backend but also additional services in the form of a mobile application, administration panel, and other things.
Suppose the project is written in TypeScript and an experienced developer has implemented the description of the project from the first line. In that case, project owners have a chance to transfer the entire code to any team who can easily familiarize themselves with it and begin to expand, improve, or support it.
If the project is written purely in JavaScript, it will take the other team much more time to understand the technical part. Calculating how much time exactly it would take is very difficult, as it varies from project to project.
Our Experience
At Geniusee, the approach to each project is individual, but the use of TypeScript in the development stack remains indispensable.
The Scout project is a prime example of this. Scout is a mobile application that allows you to exchange content, ideas, news, and other relevant things. You can shape and create exciting moments and share them with your friends and family.
Two teams took an active part in this project: the partner team from the USA and the Geniusee team. Initially, this was a complex application that used JavaScript at its core.
It consisted of:
1. mobile application - React Native, a popular library that allows you to write a mobile application for Android and iOS;
2. server side - Node.js;
3. dynamic web pages - web resources through which customers actively exchange content and have the opportunity to preview their work.
Later on, each entity was described using TypeScript and had excellent documentation. TypeScript helped minimize unnecessary communications and time spent on understanding the project.
Here are some other advantages of using TypeScript for this project:
-
Development efficiency has been maximized;
-
Each piece of code was typed, and each data had its interface;
-
The programmer had all the necessary tools for the comfortable implementation of tasks already at the development phase.
Because more than eight people took part in the development of all entities, this documentation allowed the Geniusee team to reduce the error rate to a minimum.
After successfully completing the project, the Geniusee team handed it over to the next team, which still supports the product.
The only drawback of developing a project on a TypeScript is an increase in the development time since the description of data types takes time, but in the long term, this time pays for itself. For example, checking a piece of simple code written in TypeScript usually takes about 10 minutes. In contrast, checking that same piece in Pure JavaScript takes at least 30 minutes but adding new features to the already existing code is much faster with TS.
Conclusion
Using TypeScript for EdTech development is beneficial both for the developers and for the project owners.
Based on the experience of the Geniusee team, TypeScript saves more than 60% of onboarding time for the development team. For project owners, creating services and applications with TypeScript can save a huge amount of time and resources.
If you choose to work with Geniusee on your EdTech project, we will ensure easy collaboration and any possible contribution from your team’s side.