TypeScript Overview

  • TypeScript is a typed superset of JavaScript that compiles to plain JavaScript.
  • Object-Oriented: TypeScript is OOP-based, with classes, interfaces, and static typing, similar to languages like C# or Java.
  • Angular: The Angular 2.0 framework is written in TypeScript. TypeScript was developed by Microsoft and is open-source. React and React Native are developed by Meta.
  • JavaScript: Initially for client-side, JavaScript became a server-side technology with Node.js.
  • Compilation: TypeScript is a compiled language, strongly typed and supports OOP (since 2012).
  • JavaScript Compatibility: TypeScript is ultimately just JavaScript. All TypeScript code compiles to JavaScript.

Language Types

  1. Strongly Typed / Statically Typed:
    • Examples: C, C#, Java, TypeScript
    • Syntax: int num = 10; (requires datatype declaration)
  2. Loosely Typed / Weakly Typed:
    • Examples: JavaScript, PHP

TypeScript Layers

  1. Language
  2. TypeScript Compiler
  3. TypeScript Language Services

Key Differences: TypeScript vs JavaScript

  • TypeScript is a strongly typed and OOP-supported language.
  • JavaScript is a scripting language with no static typing.

TypeScript Drawbacks

  1. Compilation Time: TypeScript takes longer to compile.
  2. Abstract Classes: TypeScript does not support abstract classes (in some cases).