After creating a numericQuantity
variable that is a casted string quantity
, I was puzzled as to why the typeof returns string even though the variable is supposed to be of type :number.
let quantity: string = '10';
let numericQuantity: number = quantity as unknown as number;
console.log(typeof quantity); // string
console.log(typeof numericQuantity); //string
I decided to experiment on the typescript playground and encountered the same outcome.