Can JavaScript be Strongly Typed

As web developers we surely have come across moment(s) that, because of JavaScript ZERO type checking ability made our life worse.

Then came TypeScript to rescue, it’s amazing that Microsoft initiated their efforts to make JavaScript more like programming languages like C#, Java.

Out of many features, Type Checking or Strongly Typed JavaScript can be called as TypeScript. You can check “Getting Started with TypeScript in ASP.NET 5 using Visual Studio 2015”.

Here is small yet significant snapshot of TypeScript features:

typescript

Let’s see what is happening here:

  1. Function “Welcome” takes parameter “Person” as number making it strongly typed.
  2. Passing variable “user” containing string. It’s obvious that NUMBER isn’t STRING.
  3. Build errors clearly stating that its assignment error.

Isn’t it like our C#, Java languages features which we cannot find in plain JavaScript.

Move you programming language skills to JavaScript by using TypeScript.

Ebook Download
View all
Learn
View all