I FINALLY Tried TypeScript | JavaScript vs TypeScript

Vikram Nayyar CS
3 min readFeb 1, 2023

Introduction:

Welcome back to the blog!

This week, I’ve decided to talk about JavaScript vs TypeScript because both of them have their use-cases and they’re quite trendy right now. I’ve finally delved into TypeScript which I think makes it even more worthwhile to talk about my initial experiences of TypeScript too!

As always, before getting into this article: be sure to applaud, leave a comment and share this article with your friends!

Follow Vikram Nayyar CS on all platforms!!!

What is TypeScript?

It’s a superset of JavaScript — meaning that it consists of everything in JavaScript and more!

Also, TypeScript is ‘strongly typed’. Essentially this means it’s a lot stricter than JavaScript and will fail to compile if you are using type’s incorrectly (for e.g. an integer when it should be a string).

Before we go any further, one distinction is that TypeScript cannot be ran in the browser. When your TS code compiles, it is actually compiled into JS which the browser then executes.

See https://stackify.com/typescript-vs-javascript-migrate/ for a simple example of JS vs TS.

The Benefits of Using TypeScript:

You might be thinking, we have to do extra work (specifying types) therefore what actually are the benefits of TypeScript?!

It allows you to identify bugs earlier (prior to runtime).

Less chances of unexpected results (you state the type and everything should match).

Allows you to organise your codebase cleaner (interfaces!).

The Drawbacks of Using TypeScript:

Can be unnecessary.

Can take time to setup the project.

The any

keyword renders TypeScript useless.

In my opinion, TypeScript is more suited to projects with a larger codebase because it will have a greater impact on eliminating the number of bugs.

Why I Made the Jump to TypeScript:

  • Type checking saves so many bugs.
  • It’s trending and only growing in popularity!
  • I believe that it will help to boost my overall proficiency in writing ‘cleaner code’.

My Experience So Far:

Bearing in mind I’ve only, used it for a week!

I’ve noticed plenty more warnings and using TypeScript has made me think more about the code I’m writing as opposed to JavaScript where I would just write code and run into unnecessary bugs.

I am looking to delve deeper into TypeScript and improve my proficiency over time.

Final Things:

Thank you for reaching the end of this post!

As always, remember to applaud and share this post, helping it reach more people!!!

Follow Vikram Nayyar CS on all platforms!!!

Hashtags:

#javascript #html #programming #css #coding #java #python #developer #programmer #webdeveloper #webdevelopment #code #coder #php #webdesign #software #softwaredeveloper #computerscience #codinglife #reactjs #technology #frontend #development #programmers #js #web #softwareengineer #programmingmemes #linux #javascriptdeveloper

--

--

Vikram Nayyar CS

Computer Science Student | Digital Content Creator!!