TypeScript

Go over the similarities/ differences, and advantages/disadvantages between Typescript and Javascript.

Features of TypeScript:

  • TypeScript Code is converted into Plain JavaScript Code:: TypeScript code is not understandable by the browsers. That's why if the code is written in TypeScript then it needs to be compiled and converted into JS code. The above process is known as transpiling. Think of transpiling as have a a human translate one language into another, in this case we are translating Typescript into Javascript.

  • JavaScript is TypeScript: Whatever code is written in JavaScript can be converted to TypeScript by changing the extension from .js to .ts.

  • Use TypeScript anywhere: TypeScript code can be run on any browser, devices or in any operating system. TypeScript is not specific to any Virtual-machine etc.

  • TypeScript supports JS libraries: With TypeScript, developers can use existing JavaScript code, incorporate popular JavaScript libraries, and can be called from other JavaScript code.

Differences between TypeScript and JavaScript:

  • Static typing

  • Modules

  • Interface

  • Optional parameters in function

Advantages of using TypeScript over JavaScript

  • TypeScript is transpiled, which results in returning any compilation errors. Because of this, at run-time the chance of getting errors is reduced whereas JavaScript is an interpreted language.

  • TypeScript has a feature which is strongly-typed or supports static typing. That means Static typing allows for checking type correctness at compile time. This is not available in JavaScript.

  • TypeScript is nothing but JavaScript and some additional features i.e. ES6 features. It may not be supported in your target browser but TypeScript compiler can compile the .ts files into ES3,ES4 and ES5 also.

Disadvantages of using TypeScript over JavaScript

  • Generally TypeScript takes time to compile the code.

  • TypeScript does not support abstract classes.

Challenge #1: ES6 & Typescript Import / Export

Your instructor will provide a repository link, then select your name from the list. This will then create a new repository for the challenge. Follow the instructions in the repositories README.MD

In order to for the assignment to be completed you must complete the assignment and run the tests as described in the README.md. Once complete you must commit your work and push it to the remote repository!

Challenge #2: Typescript & ES6 Classes

Your instructor will provide a repository link, then select your name from the list. This will then create a new repository for the challenge. Follow the instructions in the repositories README.MD

In order to for the assignment to be completed you must complete the assignment and run the tests as described in the README.md. Once complete you must commit your work and push it to the remote repository!

Resources:

Last updated