Introduction

If you are a newer JavaScript developer like me you may have come across the superset of JavaScript known as TypeScript. TypeScript is an open-source extension of JavaScript that changes JavaScript from a functional programming language into an object-oriented programming language. It does this by adding types to JavaScript. But you may be asking what’s the point of adding types to JavaScript? Well the main benefit from doing so is that it makes it a whole lot easier to catch errors in development. The problem with JavaScript is that an error generally happens on the client side of things rather than on the developer side of things. TypeScript solves this issue by letting you compile your code in your IDE before testing it out. If you’ve ever written vanilla JavaScript you know how big of a deal this is, so let’s go check it out!

Setting Up TypeScript

Image for post

To get started using TypeScript the first thing you want to do is install it globally by running the npm command: npm i -g typescript . After that let’s quickly make a index.ts file with the following code:

Image for post

#web-development #programming #typescript #javascript #react #react native

A Quick Intro to TypeScript for JavaScript Programmers
1.55 GEEK