TypeScript for React Developer

TypeScript vs JavaScript

Any Valid JavaScript is Valid TypeScript

TypeScript is superset of JavaScript

As shown in the diagram above, in addition of JavaScript, TypeScript also includes some JavaScript features that are yet to be standardized (e.g. decorator) as well as typing.

In other words, you need to know JavaScript before TypeScript.

TypeScript !== OOP

One common misconception is that writing TypeScript means you will learn Object-Oriented Programming (OOP). Unfortunately (or fortunately?) that is not the case.

Just like in JavaScript, even though OOP is supported in TypeScript, but that is not required.

In fact, I use TypeScript for more than two years and I seldom need to do OOP unless it is required by the framework/library.

You can use Both JavaScript and TypeScript in a Project

You may think that if you want to use TypeScript, you have to start a new project or rewrite everything from JavaScript to TypeScript.

Luckily, TypeScript allows you to use TypeScript and JavaScript together. You can start slow by writing new codes in TypeScript, then only when you have time to spare, converting the old code from JavaScript to TypeScript.

In fact, that's how we will learn in this workshop: migrating a React project written in JavaScript to TypeScript.

Comments

There is no comment on this post yet.

Issue on this page? Report here