TypeScript: Introduction

A beginner’s guide to TypeScript (with some history of the TypeScript)

In this lesson, we are going to learn how TypeScript came into existence and what problem it solves. We are also going to take a glance at the TypeScript compilation process.

Uday Hiwarale
May 15 · 11 min read
Image for post
Image for post
(source: unsplash.com)
(source: YouTube)
Image for post
Image for post
(Source: StackOverflow Developer Survey (2019))
Image for post
Image for post
(Source: StackOverflow Developer Survey (2019))

The failure of Dart

Google being “Google” wanted to address this problem. The developers at Google worked on a statically typed language called “Dart” that was supposed to replace the JavaScript in the browser (and hopefully on the backend side too). They planned to ship a VM in the Google Chrome browser that could run (interpret) Dart programs natively. For legacy support, Dart could transpile to JavaScript until everybody (browsers) gets on this bandwagon.

The rise of TypeScript

Let’s come back to the question, is JavaScript popular? Let’s clarify it, is JavaScript loved by the developers? I don’t think so, at least not in its entirety and other developers seem to agree with this theory.

Image for post
Image for post
(Source: StackOverflow Developer Survey (2019))
Image for post
Image for post
(program.js)
Image for post
Image for post
(program.ts)
Image for post
Image for post
(program-fixed.ts)
Image for post
Image for post
(program-fixed.js)
Image for post
Image for post
(Chrome Developer Tools Console)
Image for post
Image for post
(tsconfig.json)

More about TypeScript

TypeScript compiler is written in JavaScript, as crazy as it sounds, that’s a 100% true fact. However, the original source code of this compiler is written in TypeScript. Therefore TypeScript is self-hosted.

What to expect from this article series?

In this article series, we will discuss almost all the features TypeScript has to offer with some cool examples. You can find the source of these examples from this GitHub repository (work in progress).

  1. Complex Data Types: Then we will discuss the complex data types such as functions, classes as well as custom data types such as interfaces and enums provided by the TypeScript.
  2. Type System: TypeScript is entirely based on types. That’s why it is necessary to understand the Type System employed by the TypeScript. We will talk about this through various lessons on Type System specifications, Generics, Polymorphism, Data Immutability, and Utility Types.
  3. New Features: TypeScript being the superset of JavaScript supports the new features of ECMAScript standard. Therefore we will talk about these features in this section such as Promises using Async/Await, Decorators, etc.
  4. Module System: Module System is a hot topic in the JavaScript world at the moment. ES6 introduced support for modules natively and it is getting better day by day. In this section, we will talk about the module system and related topics.
  5. Compilation: This is where TypeScript ends, the compilation of TypeScript programs, the final frontier of TypeScript developers. In this section, we are going to discuss the configuration file tsconfig.json, the TypeScript compiler, and command-line API.
Image for post
Image for post

JsPoint

JavaScript and the Web

Uday Hiwarale

Written by

Senior Software Engineer (JS • Go • Dart • Python) / thatisuday.com ☯ github.com/thatisuday ☯ thatisuday@gmail.com

JsPoint

JsPoint

A collection of essential articles for JavaScript, WebAssembly, TypeScript, Node.js, Deno, and Web development in general.

Uday Hiwarale

Written by

Senior Software Engineer (JS • Go • Dart • Python) / thatisuday.com ☯ github.com/thatisuday ☯ thatisuday@gmail.com

JsPoint

JsPoint

A collection of essential articles for JavaScript, WebAssembly, TypeScript, Node.js, Deno, and Web development in general.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store