Introduction to Typescript

In this lecture, Harkirat offers a brief introduction to TypeScript, covering language classifications, the importance of strong typing, and an overview of TypeScript's execution. The lecture includes insights into the TypeScript compiler, implementing basic types, and understanding the distinctions between Interfaces and Types

Types of Languages

1] Loosely Typed Languages

  1. Runtime Type Association: Data types are associated with values at runtime. Unlike strongly typed languages, type information is not strictly bound during compilation but rather at the time of execution.
  2. Dynamic Type Changes: Variables can change types during execution, offering more adaptability. This flexibility allows for a dynamic approach to variable assignments and operations.
  3. Runtime Error Discovery: Type errors may be discovered during runtime, potentially leading to unexpected behaviors. This characteristic provides more freedom but requires careful handling.
  4. Examples of Loosely Typed Languages: JavaScript, Python, Ruby

C++ Code (Doesn't Work ❌)

#include <iostream>

int main() {
  int number = 10;
  number = "text";  // Error: Cannot assign a string to an integer variable
  return 0;
}

Explanation: