Exploring Typescript: Interfaces, Types & Classes

Click for: original source

Typescript is a superset of Javascript, which means that all Javascript is syntactically valid Typescript. However, Typescript’s power comes from its strict typing of objects. By Two Devs in a Pod.

Type checking often focuses on the shape of an object, ensuring that every object of a particular type adheres to a set of guidelines. The article then goes on explaining:

  • Why are types important in typescript?
  • Interfaces vs. Types
  • Mapped Types
  • Intersections & Unions
  • Object-Oriented Typescript
  • Bottom Line

Interfaces are basically a way of describing a data shape or defining a contract. Meanwhile, a type is usually used for composition of other types, like a union or intersection. That being said, they are often used interchangeably, and the most important thing to remember is to be consistent in how they are used within a codebase. You will also get links to further reading and online typescript playground. Sweet!

[Read More]

Tags javascript app-development nodejs frontend web-development