Repaso
EspaƱol
Frontend & WebFoundationsFE-61

What is TypeScript?

Options

  1. A faster version of Java made for the browser
  2. JavaScript with types, compiled down to plain JS (Correct option)
  3. A CSS preprocessor that adds variables and nesting
  4. A query language used for relational databases

Answer

JavaScript with added type annotations; it is checked before running and then compiled to plain JavaScript

Why

In JavaScript, a variable can hold anything and mistakes appear only while the program runs.

TypeScript adds types, for example let age: number = 30;. The TypeScript compiler catches mistakes (like using a string where a number is expected) before you run the code.

The result is converted to normal JavaScript, which is what browsers and Node.js run.

Remember

TypeScript = JavaScript + types.

Key terms

Practice this question in Repaso