Literal Types
A Literal Type is a single element set from a collective type, it defines a very exact value that is a JavaScript primitive.
Literal Types in TypeScript are numbers, strings, and booleans.
Example of literals:
const a = 'a'; // String literal typeconst b = 1; // Numeric literal typeconst c = true; // Boolean literal typeString, Numeric, and Boolean Literal Types are used in unions, type guards, and type aliases.
In the following example, you can see a union type alias. O consists of only the specified values, no other string is valid:
type O = 'a' | 'b' | 'c';