Instead of saying, a variable can contain a string or a number, literal type forces a particular value to a variable.
We have a const variable in our code:
const num = 80;
const variable cannot be reassigned, TypeScript marks the type of
const num: 80;
That was an example of literal type.
If a variable can have only two values
banana, we can set the type as follows:
let a: "apple" | "banana";