Literal Type, Narrowing, and Const
We'll cover the following...
Literal type #
A literal type sets a single value to a variable’s type. Initially, TypeScript supported only a string. Nowadays, a literal type can be a Boolean, a number, or an enum.
Press + to interact
let x : "test";let y : 123;let z : true;
The concept of having a value that controls the data type flow can be extended beyond type checking in order to narrow ...