The typeof command is used to check the data type of any variable in Typescript.

Example:
Variable: abc:number|string;
if (typeof abc === "number") {
   // do something
}

BY Best Interview Question ON 12 May 2020

Suggest An Answer