Literal Type (TypeScript)

A literal type is a type that allows only one exact value, such as the string `"left"` or the number `42`. Combined with unions, literal types restrict a…