You wanna get runtime type checking in TypeScript but you do not know where to get started? So, this is the right article for you 🤩.

Prerequisites

  • Have standard TypeScript understanding
  • Have IDE installed to code. eg: Visual Studio CodeSublime Text, …etc

Problem definition

Suppose that you have types as below:

interface Product {
  id: number;
  name: string;
  quantity: number;
  type: 'FURNITURE' | 'BOOK'
}

type Products = Product[];

types.ts

#iot #runtime #javascript #typescript

How to Get Runtime Type Checking in TypeScript
1.10 GEEK