What is typescript?

  • TypeScript is a language on top of JavaScript. Everything possible in JavaScript is available in TypeScript – it is a superset of JavaScript.

Typescript advantages

  • The first one is that it transpiles TypeScript into JavaScript so the advanced ECMAScript features not available to all web browsers can be used by providing a polyfill. It acts as a combination of other static checkers combined with Babel.
    • It can enforce static typing to catch potential issues earlier in the lifecycle of development. It reduces the need for some unit tests and can analyze the code to find runtime errors at design time.

Typescript Type System

  • helps with catching errors during the development
  • uses type annotations to analyze code
  • only active during development
  • doesn’t provide any performance optimization

TypeScript Philosophy

  • Statically identify constructs that are likely to be errors.
  • Provide a structuring mechanism for larger pieces of code.
  • Impose no runtime overhead on emitted programs.
  • Emit clean, idiomatic, recognizable JavaScript code.
  • Produce a language that is composable and easy to reason about.
  • Align with current and future ECMAScript proposals.
  • Preserve runtime behavior of all JavaScript code.
  • Avoid adding expression-level syntax.
  • Use a consistent, fully erasable, structural type system.
  • Be a cross-platform development tool.
  • Do not cause substantial breaking changes from TypeScript 1.0.

TypeScript - Types and Type System TypeScript - Type Annotations and Type Inference TypeScript - Numbers TypeScript - Enum TypeScript - Generics TypeScript - Functions TypeScript - Reusable Code